Commit 16041773 authored by iv's avatar iv

ERP5Workflow: fix bad name + useless if

parent 14517d93
......@@ -22,40 +22,37 @@ portal_workflow = context.portal_workflow
portal_type_list = context.portal_types.objectValues()
chain_dict = portal_workflow.getChainsByType()
for portal_type in portal_type_list:
pt_id = portal_type.id
associated_workflow_id_list = []
associated_workflow_id_list.extend(portal_type.getTypeWorkflowList())
if pt_id in chain_dict:
associated_workflow_id_list.extend(list(chain_dict[pt_id]))
if portal_type.id in chain_dict:
associated_workflow_id_list.extend(list(chain_dict[portal_type.id]))
for wf_id in associated_workflow_id_list:
wf = getattr(context.portal_workflow, wf_id, None)
if wf is None:
continue
state_var = wf.getStateVariable()
if wf.getStateValueDict():
state_value_list = wf.getStateValueDict()
for state_ref, state in state_value_list.items():
for state_id, state in wf.getStateValueDict().items():
for lang in supported_languages:
key = (lang, pt_id, state_var, state_ref)
key = (lang, portal_type.id, state_var, state_id)
if not translated_keys.has_key(key):
translated_message = context.Localizer.erp5_ui.gettext(state_ref, lang=lang).encode('utf-8')
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=pt_id, original_message=state_ref,
object_list.append(dict(language=lang, message_context=state_var, portal_type=portal_type.id, original_message=state_id,
translated_message=translated_message))
# translate state title as well
state_title = state.title
if state_title is not None and state_title != '':
if state.title is not None and state.title != '':
state_var_title = '%s_title' % state_var
msg_id = getMessageIdWithContext(state_title, 'state', wf_id)
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, pt_id, state_var_title, state_ref, msg_id)
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.id, 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=pt_id, original_message=state_ref,
object_list.append(dict(language=lang, message_context=state_var_title, portal_type=portal_type.id, original_message=state_id,
translated_message=translated_message))
if 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