add check for translation through domain alias

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33049 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0f9a2cb3
...@@ -324,6 +324,10 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -324,6 +324,10 @@ class TestTranslation(ERP5TypeTestCase):
# translation # translation
self.portal.Localizer.get_selected_language = LanguageGetter(self.lang) self.portal.Localizer.get_selected_language = LanguageGetter(self.lang)
# create the zpt used by self.translate_by_zpt()
dispatcher = self.portal.manage_addProduct['PageTemplates']
dispatcher.manage_addPageTemplate('myzpt')
self.myzpt = self.portal.myzpt
self.stepTic() self.stepTic()
def beforeTearDown(self): def beforeTearDown(self):
...@@ -342,6 +346,7 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -342,6 +346,7 @@ class TestTranslation(ERP5TypeTestCase):
# erase created objects # erase created objects
for module in (self.portal.person_module, self.portal.organisation_module): for module in (self.portal.person_module, self.portal.organisation_module):
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
self.portal.manage_delObjects(['myzpt'])
self.stepTic() self.stepTic()
ERP5TypeTestCase.beforeTearDown(self) ERP5TypeTestCase.beforeTearDown(self)
...@@ -351,19 +356,25 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -351,19 +356,25 @@ class TestTranslation(ERP5TypeTestCase):
erp5_ui = self.portal.Localizer.erp5_ui erp5_ui = self.portal.Localizer.erp5_ui
self.assertEquals(erp5_ui.gettext('Person', lang=self.lang), 'Personne') self.assertEquals(erp5_ui.gettext('Person', lang=self.lang), 'Personne')
def test_ZPT_translation(self): def translate_by_zpt(self, domain, *words):
dispatcher = self.portal.manage_addProduct['PageTemplates']
myzpt = dispatcher.manage_addPageTemplate('myzpt')
zpt_template = """ zpt_template = """
<tal:ommit xmlns:i18n="http://xml.zope.org/namespaces/i18n" <tal:ommit xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="erp5_ui"> i18n:domain="%s">
<tal:ommit i18n:translate="">Person</tal:ommit> <tal:ommit repeat="word options/words" content="word"
<tal:ommit i18n:translate="">Draft</tal:ommit> i18n:translate="">Word</tal:ommit>
</tal:ommit> </tal:ommit>
""" """ % domain
myzpt.pt_edit(zpt_template, self.myzpt.pt_edit(zpt_template, 'text/html')
'text/html') results = to_utf8(self.myzpt(words=words)).split()
results = to_utf8(myzpt()).split() return results
def test_ZPT_translation(self):
results = self.translate_by_zpt('erp5_ui', 'Person', 'Draft')
self.assertEquals(results, ['Personne', 'Brouillon'])
def test_ZPT_translation_with_domain_alias(self):
# test with a translation domain alias
results = self.translate_by_zpt('ui', 'Person', 'Draft')
self.assertEquals(results, ['Personne', 'Brouillon']) self.assertEquals(results, ['Personne', 'Brouillon'])
def test_portal_type_and_state_title_translation_on_portal_catalog(self): def test_portal_type_and_state_title_translation_on_portal_catalog(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment