Commit d5d22c74 authored by Jérome Perrin's avatar Jérome Perrin

data protection: translate workflow messages when displayed

If we call Base_translateString before storing the message in the
history, the message will be translated when this action is used and
stored as translated using the language of the user executing this action.

The proper way is to store a message in history, so that it is rendered
when displayed.
parent 0abd2f10
No related merge requests found
from Products.ERP5Type.Message import translateString
portal = context.getPortalObject()
selection_name = 'data_protection_request_erase_data_selection'
property_id_list = portal.portal_selections.getSelectionCheckedUidsFor(selection_name)
......@@ -9,7 +10,7 @@ clean_up_done = False
# First: Purge workflow history comments
if flush_worklfow_history_comment:
document_to_cleanup.Base_purgeWorkflowHistoryCommentList()
edit_message = portal.Base_translateString('Workflow comments deleted by data protection manager')
edit_message = translateString('Workflow comments deleted by data protection manager')
portal.portal_workflow.doActionFor(document_to_cleanup, 'edit_action', comment=edit_message)
clean_up_done = True
......@@ -18,7 +19,7 @@ if property_id_list:
edit_kw = {}
[edit_kw.update({property_id: None}) for property_id in property_id_list]
edit_message = portal.Base_translateString('Properties deleted by data protection manager: ${items}',
edit_message = translateString('Properties deleted by data protection manager: ${items}',
mapping={'items': ', '.join(property_id_list)})
portal.portal_workflow.doActionFor(document_to_cleanup, 'edit_action', comment=edit_message)
......
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