Commit e2d82a7d authored by Sebastien Robin's avatar Sebastien Robin

use Message for translation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6114 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a4be0bf9
...@@ -33,6 +33,7 @@ from Products.ERP5Type.Utils import convertToUpperCase ...@@ -33,6 +33,7 @@ from Products.ERP5Type.Utils import convertToUpperCase
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Globals import get_request from Globals import get_request
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
from Products.ERP5Type.Message import Message
import string import string
...@@ -349,14 +350,6 @@ class RelationStringFieldValidator(Validator.StringValidator): ...@@ -349,14 +350,6 @@ class RelationStringFieldValidator(Validator.StringValidator):
# If the value is different, build a query # If the value is different, build a query
portal_selections = getToolByName(field, 'portal_selections') portal_selections = getToolByName(field, 'portal_selections')
portal_catalog = getToolByName(field, 'portal_catalog') portal_catalog = getToolByName(field, 'portal_catalog')
localizer = getToolByName( field
, 'Localizer'
, None
)
if localizer is not None:
N_ = localizer.erp5_ui.gettext
else :
N_ = lambda msg, **kw: msg
# Get the current value # Get the current value
value = Validator.StringValidator.validate(self, field, key, REQUEST) value = Validator.StringValidator.validate(self, field, key, REQUEST)
# If the value is the same as the current field value, do nothing # If the value is the same as the current field value, do nothing
...@@ -419,7 +412,10 @@ class RelationStringFieldValidator(Validator.StringValidator): ...@@ -419,7 +412,10 @@ class RelationStringFieldValidator(Validator.StringValidator):
menu_item_list = [('', '')] menu_item_list = [('', '')]
new_object_menu_item_list = [] new_object_menu_item_list = []
for p in portal_type: for p in portal_type:
new_object_menu_item_list += [ ( N_('New %s') % (N_(p)) translated_p = Message(domain='erp5_ui',message=p)
message = Message(domain='erp5_ui',message = 'New ${portal_type}',
mapping={'portal_type':translated_p})
new_object_menu_item_list += [ ( message
, '%s%s' % (new_content_prefix,p) , '%s%s' % (new_content_prefix,p)
) )
] ]
......
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