Commit 69287938 authored by iv's avatar iv

ERP5Workflow: put back compatibility code in ERP5Site_updateTranslationTable

with old DCWorkflow, portal_workflow could contain the chain_dict for portal_type/workflow
association
parent e3d39477
...@@ -52,6 +52,43 @@ for portal_type in portal_type_list: ...@@ -52,6 +52,43 @@ for portal_type in portal_type_list:
translated_keys[key] = None # mark as translated translated_keys[key] = None # mark as translated
object_list.append(dict(language=lang, message_context=state_var_title, portal_type=portal_type.id, original_message=state_id, object_list.append(dict(language=lang, message_context=state_var_title, portal_type=portal_type.id, original_message=state_id,
translated_message=translated_message)) translated_message=translated_message))
### Compatibility code for DC workflow ###
for wf_id, portal_type_list in portal_workflow.getChainDict().items():
wf = getattr(portal_workflow, wf_id, None)
if wf is None:
continue
state_var = wf.variables.getStateVar()
if wf.states:
for state_id, state in wf.states.items():
for lang in supported_languages:
for portal_type in portal_type_list:
key = (lang, portal_type, state_var, state_id)
if not translated_keys.has_key(key):
translated_message = context.Localizer.erp5_ui.gettext(state_id, lang=lang).encode('utf-8')
translated_keys[key] = None # mark as translated
object_list.append(dict(language=lang, message_context=state_var, portal_type=portal_type, original_message=state_id,
translated_message=translated_message))
# translate state title as well
if state.title != '' :
state_var_title = '%s_title' % state_var
msg_id = getMessageIdWithContext(state.title, 'state', wf.id)
translated_message = context.Localizer.erp5_ui.gettext(msg_id, default='', lang=lang).encode('utf-8')
if translated_message == '':
msg_id = state.title
translated_message = context.Localizer.erp5_ui.gettext(state.title.decode('utf-8'), lang=lang).encode('utf-8')
key = (lang, portal_type, state_var_title, state_id, msg_id)
if not translated_keys.has_key(key):
translated_keys[key] = None # mark as translated
object_list.append(dict(language=lang, message_context=state_var_title, portal_type=portal_type, original_message=state_id,
translated_message=translated_message))
### End of compatibility code for DC workflow ###
if object_list: if object_list:
catalog_translation_list(object_list) catalog_translation_list(object_list)
......
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