Commit 035997da authored by Jérome Perrin's avatar Jérome Perrin

Translate "New (Portal Type)" in RelationField Validator


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4294 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f2f29256
...@@ -321,6 +321,11 @@ class RelationStringFieldValidator(Validator.StringValidator): ...@@ -321,6 +321,11 @@ 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')
translation_service = getToolByName(field, 'translation_service', None)
if translation_service is not None:
N_ = translation_service.translate
else :
N_ = lambda catalog, msg: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
...@@ -375,7 +380,7 @@ class RelationStringFieldValidator(Validator.StringValidator): ...@@ -375,7 +380,7 @@ 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 += [('New %s' % p, '%s%s' % (new_content_prefix,p))] new_object_menu_item_list += [(N_('ui', 'New %s') % N_('ui', p), '%s%s' % (new_content_prefix,p))]
# If the length is 1, return uid # If the length is 1, return uid
if len(relation_list) == 1: if len(relation_list) == 1:
relation_uid = relation_uid_list[0] relation_uid = relation_uid_list[0]
......
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