Commit c9e6e109 authored by Mame Coumba Sall's avatar Mame Coumba Sall

2009-03-16 mame

*modified script to translate workflow state titles with a message id with context.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26042 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 15511e0c
......@@ -78,6 +78,9 @@ def getActorName(actor):\n
actor_name_cache[actor] = person.getTitle()\n
return actor_name_cache[actor]\n
\n
def getMessageIdForWorkflowState(title, workflow_id):\n
return \'%s [state in %s]\' % (title, workflow_id)\n
\n
# Get history\n
# XXX Compatibility\n
for history_name in [\'history\', \'building_history\', \'installation_history\']:\n
......@@ -117,14 +120,17 @@ for workflow_item in workflow_item_list:\n
value = wf_transitions.get(value, marker) and (wf_transitions[value].id or wf_transitions[value].actbox_name) or value\n
if display:\n
if key == \'error_message\' and same_type(value, \'\'):\n
value = context.Localizer.erp5_ui.gettext(value)\n
value = context.Localizer.erp5_ui.gettext(value) \n
elif key == \'error_message\' and same_type(value, []):\n
value = \'. \'.join([\'%s\' % x for x in value])\n
elif key == \'error_message\':\n
value = \'%s\' % value\n
elif key == \'actor\':\n
value = getActorName(value)\n
elif same_type(value, \'\') and key in ( \'action\', \'state\' ): \n
elif same_type(value, \'\') and key in (\'state\' ):\n
value = getMessageIdForWorkflowState(value, workflow_id) \n
value = context.Localizer.erp5_ui.gettext(value)\n
elif same_type(value, \'\') and key in ( \'action\'):\n
value = context.Localizer.erp5_ui.gettext(value)\n
if value is marker:\n
value = \'Does not exist\'\n
......@@ -215,6 +221,7 @@ return result\n
<string>dict</string>
<string>actor_name_cache</string>
<string>getActorName</string>
<string>getMessageIdForWorkflowState</string>
<string>history_name</string>
<string>workflow_item_list</string>
<string>_getitem_</string>
......
......@@ -82,7 +82,11 @@ for wf in context.portal_workflow.objectValues():\n
# translate state title as well\n
if state.title != \'\' :\n
state_var_title = \'%s_title\' % state_var\n
translated_message = context.Localizer.erp5_ui.gettext(state.title.decode(\'utf-8\'), lang=lang).encode(\'utf-8\')\n
msg_id = \'%s [state in %s]\' % (state.title, wf.id)\n
translated_message = context.Localizer.erp5_ui.gettext(msg_id, default=\'\').encode(\'utf-8\')\n
if translated_message == \'\':\n
translated_message = context.Localizer.erp5_ui.gettext(state.title.decode(\'utf-8\'), lang=lang).encode(\'utf-8\')\n
#translated_message = context.Localizer.erp5_ui.gettext(state.title.decode(\'utf-8\'), lang=lang).encode(\'utf-8\')\n
key = (lang, state_var_title, state_id, state.title)\n
if not translated_keys.has_key(key):\n
translated_keys[key] = None # mark as translated\n
......@@ -177,6 +181,7 @@ return printed\n
<string>obj</string>
<string>_inplacevar_</string>
<string>state_var_title</string>
<string>msg_id</string>
<string>translated_message</string>
<string>ptype</string>
<string>title</string>
......
1104
\ No newline at end of file
1111
\ No newline at end of file
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