Commit bc3677f1 authored by wenjie.zheng's avatar wenjie.zheng

erp5_core: fix ERP5Site_updateTranslationTable didn't update translation table problem.

parent 1a149fbf
...@@ -72,25 +72,27 @@ def catalog_translation_list(object_list):\n ...@@ -72,25 +72,27 @@ def catalog_translation_list(object_list):\n
object_list = []\n object_list = []\n
portal_workflow = context.portal_workflow\n portal_workflow = context.portal_workflow\n
portal_type_list = context.portal_types.objectValues()\n portal_type_list = context.portal_types.objectValues()\n
chain_dict = portal_workflow.getChainDict()\n chain_dict = portal_workflow.getChainsByType()\n
for wf in portal_workflow.objectValues():\n for portal_type in portal_type_list:\n
if wf is None:\n pt_id = portal_type.getId()\n
continue\n associated_workflow_id_list = []\n
wf_id = wf.getId()\n associated_workflow_id_list.extend(portal_type.getTypeWorkflowList())\n
state_var = wf.getStateVariable()\n if pt_id in chain_dict:\n
if wf.getStateValueList():\n associated_workflow_id_list.extend(list(chain_dict[pt_id]))\n
state_value_list = wf.getStateValueList().items()\n for wf_id in associated_workflow_id_list:\n
for state_id, state in state_value_list:\n wf = getattr(context.portal_workflow, wf_id, None)\n
for lang in supported_languages:\n if wf is None:\n
for portal_type in portal_type_list:\n continue\n
if wf_id not in portal_type.getTypeWorkflowList() and portal_type.getId() not in getattr(chain_dict, wf_id,[]):\n state_var = wf.getStateVariable()\n
# do not check unrelated portal type.\n if wf.getStateValueList():\n
continue\n state_value_list = wf.getStateValueList()\n
key = (lang, portal_type, state_var, state_id)\n for state_ref, state in state_value_list.items():\n
for lang in supported_languages:\n
key = (lang, pt_id, state_var, state_ref)\n
if not translated_keys.has_key(key):\n if not translated_keys.has_key(key):\n
translated_message = context.Localizer.erp5_ui.gettext(state_id, lang=lang).encode(\'utf-8\')\n translated_message = context.Localizer.erp5_ui.gettext(state_ref, lang=lang).encode(\'utf-8\')\n
translated_keys[key] = None # mark as translated\n translated_keys[key] = None # mark as translated\n
object_list.append(dict(language=lang, message_context=state_var, portal_type=portal_type, original_message=state_id,\n object_list.append(dict(language=lang, message_context=state_var, portal_type=pt_id, original_message=state_ref,\n
translated_message=translated_message))\n translated_message=translated_message))\n
\n \n
# translate state title as well\n # translate state title as well\n
...@@ -101,10 +103,10 @@ for wf in portal_workflow.objectValues():\n ...@@ -101,10 +103,10 @@ for wf in portal_workflow.objectValues():\n
if translated_message == \'\':\n if translated_message == \'\':\n
msg_id = state.title\n msg_id = state.title\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, portal_type, state_var_title, state_id, msg_id)\n key = (lang, pt_id, state_var_title, state_ref, msg_id)\n
if not translated_keys.has_key(key):\n if not translated_keys.has_key(key):\n
translated_keys[key] = None # mark as translated\n translated_keys[key] = None # mark as translated\n
object_list.append(dict(language=lang, message_context=state_var_title, portal_type=portal_type, original_message=state_id,\n object_list.append(dict(language=lang, message_context=state_var_title, portal_type=pt_id, original_message=state_ref,\n
translated_message=translated_message))\n translated_message=translated_message))\n
if object_list:\n if object_list:\n
catalog_translation_list(object_list)\n catalog_translation_list(object_list)\n
......
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