Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
511dee09
Commit
511dee09
authored
Mar 14, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: verify we can use translated related keys with non-ascii text
parent
7c1c7a86
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
...tTemplateItem/portal_components/test.erp5.testERP5Base.py
+43
-1
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
View file @
511dee09
##############################################################################
#
#
coding: utf-8
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Kevin Deldycke <kevin_AT_nexedi_DOT_com>
#
...
...
@@ -1103,6 +1103,48 @@ class TestERP5Base(ERP5TypeTestCase):
translated_portal_type
=
'Personne'
)])
self
.
abort
()
def
test_standard_translated_related_keys_non_ascii
(
self
):
# make sure we can search by "translated_validation_state_title" and
# "translated_portal_type" with non ascii translations
message_catalog
=
self
.
portal
.
Localizer
.
erp5_ui
lang
=
'fr'
if
lang
not
in
[
x
[
'id'
]
for
x
in
self
.
portal
.
Localizer
.
get_languages_map
()]:
self
.
portal
.
Localizer
.
manage_addLanguage
(
lang
)
message_catalog
.
gettext
(
'Draft'
,
add
=
1
)
message_catalog
.
gettext
(
'Person'
,
add
=
1
)
message_catalog
.
message_edit
(
'Draft'
,
lang
,
u'Broüillon'
,
''
)
message_catalog
.
message_edit
(
'Person'
,
lang
,
u'Pérsonne'
,
''
)
self
.
portal
.
ERP5Site_updateTranslationTable
()
person_1
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
first_name
=
'名前'
)
person_1
.
validate
()
person_2
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
self
.
tic
()
# patch the method, we'll abort later
self
.
portal
.
Localizer
.
get_selected_language
=
lambda
:
lang
self
.
assertEqual
({
person_1
,
person_2
},
{
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_portal_type
=
'Pérsonne'
)})
self
.
assertEqual
({
person_2
,
organisation
},
{
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_validation_state_title
=
'Broüillon'
,
portal_type
=
(
'Person'
,
'Organisation'
))})
self
.
assertEqual
([
person_2
],
[
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
translated_validation_state_title
=
'Broüillon'
,
translated_portal_type
=
'Pérsonne'
)])
self
.
assertEqual
([
person_1
],
[
x
.
getObject
()
for
x
in
self
.
portal
.
portal_catalog
(
title
=
'名前'
,
translated_portal_type
=
'Pérsonne'
)])
self
.
abort
()
def
test_Base_createCloneDocument
(
self
):
module
=
self
.
portal
.
person_module
module
.
manage_permission
(
'Add portal content'
,
[
'Member'
],
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment