diff --git a/product/ERP5Form/MultiRelationField.py b/product/ERP5Form/MultiRelationField.py index e230f2694605983e8b93884f4f956130ceca977b..611c0706bf3a5307b1f0731c6c088e0d8a559b31 100644 --- a/product/ERP5Form/MultiRelationField.py +++ b/product/ERP5Form/MultiRelationField.py @@ -42,6 +42,9 @@ from Globals import get_request from AccessControl import Unauthorized from AccessControl import getSecurityManager +# a marker function for translation. +N_ = lambda msg, **kw: str(Message('erp5_ui', msg, **kw)) + # Max. number of catalog result MAX_SELECT = 30 NEW_CONTENT_PREFIX = '_newContent_' @@ -556,12 +559,10 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator): # form is not validated ############################## portal_type = relation_uid[len(NEW_CONTENT_PREFIX):] - translated_portal_type = Message(domain='erp5_ui', - message=portal_type) + translated_portal_type = N_(portal_type) # XXX Replace New by Add - message = Message( - domain='erp5_ui', message='New ${portal_type}', - mapping={'portal_type': translated_portal_type}) + message = N_('New ${portal_type}', + mapping={'portal_type': translated_portal_type}) display_text = message else: display_text = 'Object has been deleted' @@ -653,11 +654,9 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator): # form is not validated ############################## portal_type = relation_uid[len(NEW_CONTENT_PREFIX):] - translated_portal_type = Message(domain='erp5_ui', - message=portal_type) - message = Message( - domain='erp5_ui', message='New ${portal_type}', - mapping={'portal_type': translated_portal_type}) + translated_portal_type = N_(portal_type) + message = N_('New ${portal_type}', + mapping={'portal_type': translated_portal_type}) display_text = message else: display_text = 'Object has been deleted' @@ -736,11 +735,9 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator): pass else: if portal_type in module.getVisibleAllowedContentTypeList(): - translated_portal_type = Message(domain='erp5_ui', - message=portal_type) - message = Message( - domain='erp5_ui', message='Add ${portal_type}', - mapping={'portal_type': translated_portal_type}) + translated_portal_type = N_(portal_type) + message = N_('Add ${portal_type}', + mapping={'portal_type':translated_portal_type}) menu_item_list.append((message, '%s%s' % (NEW_CONTENT_PREFIX, portal_type))) diff --git a/product/ERP5Form/SelectionTool.py b/product/ERP5Form/SelectionTool.py index f516adac4fc16e0f7982458f73e395dd8cf03d7c..71a35df40f37fa2a6177bb74debeabe306598f82 100644 --- a/product/ERP5Form/SelectionTool.py +++ b/product/ERP5Form/SelectionTool.py @@ -46,6 +46,9 @@ from Acquisition import aq_base from Products.ERP5Type.Message import Message import warnings +# a marker function for translation. +N_ = lambda msg, **kw: str(Message('erp5_ui', msg, **kw)) + _MARKER = [] class SelectionError( Exception ): @@ -1112,12 +1115,9 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): if len(field_value) > 1 and isinstance(field_value, type([])): field_value = ' OR '.join(field_value) REQUEST.form[field_key] = field_value - portal_status_message = Message( - domain='erp5_ui', - message="Please select one (or more) object.") + portal_status_message = N_("Please select one (or more) object.") else: - portal_status_message = Message(domain='erp5_ui', - message="Please select one object.") + portal_status_message = N_("Please select one object.") # Save the current REQUEST form