Commit 60622d2d authored by Nicolas Delaby's avatar Nicolas Delaby

normalize indentation and cleanup extra spaces

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33960 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 22017de7
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2004,2007,2009 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2004,2007,2009 Nexedi SA and Contributors. All Rights Reserved.
......
...@@ -100,7 +100,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): ...@@ -100,7 +100,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase):
return target_business_templates return target_business_templates
def getTranslation(self, msgid): def getTranslation(self, msgid):
result = self.portal.Localizer.erp5_ui.gettext( result = self.portal.Localizer.erp5_ui.gettext(
msgid, default='') msgid, default='')
#result = self.portal.Localizer.translate( #result = self.portal.Localizer.translate(
...@@ -132,7 +132,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): ...@@ -132,7 +132,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase):
for state in workflow.states.items(): for state in workflow.states.items():
state_title = state[1].title state_title = state[1].title
state_id = state[0] state_id = state[0]
msgid = '%s [state in %s]' % (state_title, workflow_id) msgid = '%s [state in %s]' % (state_title, workflow_id)
translated_state_title = self.getTranslation(msgid) translated_state_title = self.getTranslation(msgid)
if translated_state_title is not None: if translated_state_title is not None:
...@@ -184,7 +184,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): ...@@ -184,7 +184,7 @@ class TestWorkflowStateTitleTranslation(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
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:
...@@ -201,7 +201,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): ...@@ -201,7 +201,7 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase):
self.logMessage( self.logMessage(
"\t%r\t%r\t'%s'" % \ "\t%r\t%r\t'%s'" % \
item) item)
self.fail(self.message) self.fail(self.message)
def test_01_EnglishTranslation(self, quiet=0, run=run_all_test): def test_01_EnglishTranslation(self, quiet=0, run=run_all_test):
...@@ -238,14 +238,14 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): ...@@ -238,14 +238,14 @@ class TestWorkflowStateTitleTranslation(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, def test_06_FrenchTranslationOfMessageWithContext(self, quiet=0,
run=run_all_test): run=run_all_test):
""" """
Test French translation Test French translation
""" """
self.lang = 'fr' self.lang = 'fr'
message_catalog = self.portal.Localizer.erp5_ui message_catalog = self.portal.Localizer.erp5_ui
message_catalog.gettext('Validated', add=1) message_catalog.gettext('Validated', add=1)
message_catalog.gettext("Draft",add=1) message_catalog.gettext("Draft",add=1)
...@@ -263,12 +263,12 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase): ...@@ -263,12 +263,12 @@ class TestWorkflowStateTitleTranslation(ERP5TypeTestCase):
item_module = self.getPortal().item_module item_module = self.getPortal().item_module
item = item_module.newContent(portal_type='Item', item = item_module.newContent(portal_type='Item',
title = 'Lot A') title = 'Lot A')
transaction.commit() transaction.commit()
self.tic() self.tic()
self.portal.Localizer.get_selected_language = lambda: self.lang self.portal.Localizer.get_selected_language = lambda: self.lang
self.assertEquals( self.assertEquals(
item.getTranslatedValidationStateTitle(),'Draft') item.getTranslatedValidationStateTitle(),'Draft')
item.validate() item.validate()
...@@ -286,7 +286,7 @@ class LanguageGetter(MethodObject.Method): ...@@ -286,7 +286,7 @@ class LanguageGetter(MethodObject.Method):
return self.lang return self.lang
class TestTranslation(ERP5TypeTestCase): class TestTranslation(ERP5TypeTestCase):
lang = 'fr' lang = 'fr'
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
...@@ -311,7 +311,7 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -311,7 +311,7 @@ class TestTranslation(ERP5TypeTestCase):
def afterSetUp(self): def afterSetUp(self):
ERP5TypeTestCase.afterSetUp(self) ERP5TypeTestCase.afterSetUp(self)
self._setUpTranslations() self._setUpTranslations()
# replace Localizer.utils.lang_negotiator in MessageCatalog to return # replace Localizer.utils.lang_negotiator in MessageCatalog to return
# self.lang # self.lang
from Products.Localizer import MessageCatalog from Products.Localizer import MessageCatalog
...@@ -385,12 +385,12 @@ class TestTranslation(ERP5TypeTestCase): ...@@ -385,12 +385,12 @@ 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')
self.stepTic() self.stepTic()
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')]))
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