Commit 3a3be130 authored by Mame Coumba Sall's avatar Mame Coumba Sall

new tests to verify translation of message id with context and message id without context

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26075 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 27a32598
...@@ -36,7 +36,7 @@ from AccessControl.SecurityManagement import newSecurityManager, \ ...@@ -36,7 +36,7 @@ from AccessControl.SecurityManagement import newSecurityManager, \
from Products.ERP5Type.tests.Sequence import Sequence, SequenceList from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
from string import zfill from string import zfill
import sys import sys
from zLOG import LOG
from Products.ERP5Type.Message import Message from Products.ERP5Type.Message import Message
# dependency order # dependency order
...@@ -188,8 +188,7 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -188,8 +188,7 @@ class TestTranslation(ERP5TypeTestCase):
error_dict[key].append(( error_dict[key].append((
workflow_id, wrong_state_id, state_title, state_id_list)) workflow_id, wrong_state_id, state_title, state_id_list))
error = 1 error = 1
#import pdb
#pdb.set_trace()
if error: if error:
for key, item_list in error_dict.items(): for key, item_list in error_dict.items():
if len(item_list) != 0: if len(item_list) != 0:
...@@ -243,7 +242,46 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -243,7 +242,46 @@ class TestTranslation(ERP5TypeTestCase):
""" """
self.lang = 'pt-BR' self.lang = 'pt-BR'
self.checkWorkflowStateTitle(quiet=quiet, run=run) self.checkWorkflowStateTitle(quiet=quiet, run=run)
def test_06_FrenchTranslationOfMessageWithContext(self, quiet=0,
run=run_all_test):
"""
Test French translation
"""
self.lang = 'fr'
message_catalog = self.portal.Localizer.erp5_ui
message_catalog.gettext('Validated', add=1)
message_catalog.gettext("Draft",add=1)
message_catalog.gettext("Validated [state in item_workflow]", add=1)
message_catalog.message_edit(
'Validated', self.lang, 'Validé', '')
message_catalog.message_edit(
"Validated [state in item_workflow]",self.lang,"En bon usage", '')
message_catalog.message_edit('Draft', self.lang, '', '')
organisation_module = self.getPortal().organisation_module
organisation = organisation_module.newContent(
portal_type='Organisation',
title = 'My Organisation')
organisation.validate()
item_module = self.getPortal().item_module
item = item_module.newContent(portal_type='Item',
title = 'Lot A')
transaction.commit()
self.tic()
self.portal.Localizer.get_selected_language = lambda: self.lang
self.assertEquals(
item.getTranslatedValidationStateTitle(),'Draft')
item.validate()
self.assertEquals(item.getTranslatedValidationStateTitle(),
"En bon usage")
self.assertEquals(
organisation.getTranslatedValidationStateTitle(),'Validé')
def test_standard_translated_related_keys(self): def test_standard_translated_related_keys(self):
# make sure we can search by "translated_validation_state_title" and # make sure we can search by "translated_validation_state_title" and
# "translated_portal_type" # "translated_portal_type"
...@@ -263,15 +301,17 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -263,15 +301,17 @@ class TestTranslation(ERP5TypeTestCase):
person_2 = self.portal.person_module.newContent(portal_type='Person') person_2 = self.portal.person_module.newContent(portal_type='Person')
organisation = self.portal.organisation_module.newContent( organisation = self.portal.organisation_module.newContent(
portal_type='Organisation') portal_type='Organisation')
transaction.commit() transaction.commit()
self.tic() self.tic()
# patch the method, we'll abort later # patch the method, we'll abort later
self.portal.Localizer.get_selected_language = lambda: lang self.portal.Localizer.get_selected_language = lambda: lang
self.assertEquals(set([person_1, person_2]), self.assertEquals(set([person_1, person_2]),
set([x.getObject() for x in set([x.getObject() for x in
self.portal.portal_catalog(translated_portal_type='Personne')])) self.portal.portal_catalog(translated_portal_type='Personne')]))
LOG("ORGANISATION TEST",0,organisation)
self.assertEquals(set([person_2, organisation]), self.assertEquals(set([person_2, organisation]),
set([x.getObject() for x in set([x.getObject() for x in
self.portal.portal_catalog(translated_validation_state_title='Brouillon', self.portal.portal_catalog(translated_validation_state_title='Brouillon',
......
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