Commit b0d9d922 authored by Yusei Tahara's avatar Yusei Tahara

Use N_ function for translation message so that message will be found automatically.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23207 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b6438a4f
......@@ -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,11 +559,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)
translated_portal_type = N_(portal_type)
# XXX Replace New by Add
message = Message(
domain='erp5_ui', message='New ${portal_type}',
message = N_('New ${portal_type}',
mapping={'portal_type': translated_portal_type})
display_text = message
else:
......@@ -653,10 +654,8 @@ 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}',
translated_portal_type = N_(portal_type)
message = N_('New ${portal_type}',
mapping={'portal_type': translated_portal_type})
display_text = message
else:
......@@ -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)))
......
......@@ -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
......
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