Commit a15ab206 authored by Kevin Deldycke's avatar Kevin Deldycke

translate() method support language and mapping as parameters


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5273 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4c2e3208
......@@ -546,8 +546,8 @@ class ListBoxWidget(Widget.Widget):
list_action += '&reset=1'
object_list = []
#translate = portal_object.translation_service.translate
# This translate() method has the same prototype as the one defined in Translation Service
# This translate() method has the same prototype as the one defined
# in Translation Service, but use Localizer.
global localizer, msg_catalog_binding
localizer = portal_object.Localizer
msg_catalog_binding = { "ui" : "erp5_ui"
......@@ -565,10 +565,13 @@ class ListBoxWidget(Widget.Widget):
localizer_cat = localizer[localizer_cat_id]
if default == None:
default = []
return localizer_cat.gettext( message = msgid
, lang = None
translated_str = localizer_cat.gettext( message = msgid
, lang = target_language
, default = default
)
if type(mapping) is type({}):
return string.Template(translated_str).substitute(mapping)
return translated_str
# Make sure list_result_item is defined
list_result_item = []
......
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