Commit 4ee8d48a authored by Mame Coumba Sall's avatar Mame Coumba Sall

new methods added for translation in workflow

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26077 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3460448c
...@@ -263,17 +263,29 @@ def getPath(object_or_path, **kw): ...@@ -263,17 +263,29 @@ def getPath(object_or_path, **kw):
if kw.get('tuple'): if kw.get('tuple'):
return path.split('/') return path.split('/')
return path return path
def int2letters(i): # Get Message Id for Workflow State
""" def getMessageIdForWorkflowState(title, workflow_id):
Convert an integer to letters, to generate spreadsheet column id return '%s [state in %s]' % (title, workflow_id)
A, B, C ..., Z, AA, AB, ..., AZ, BA, ..., ZZ, AAA ...
""" def getMessageIdWithContext(msg_id,context,workflow_id):
if i < 26: return '%s [%s in %s]' % (msg_id,context, workflow_id)
return (chr(i + ord('A')))
d, m = divmod(i, 26) def getTranslationStringWithContext(self,msg_id, context, context_id):
return int2letter(d - 1) + int2letter(m) portal = self.getPortalObject()
portal_workflow = portal.portal_workflow
localizer = portal.Localizer
selected_language = localizer.get_selected_language()
msg_id_context = getMessageIdWithContext(msg_id,context, context_id)
result = localizer.erp5_ui.gettext(
msg_id_context,default='')
if result == '':
result = localizer.erp5_ui.gettext(msg_id)
return result.encode('utf8')
from AccessControl import ModuleSecurityInfo
ModuleSecurityInfo('Products.ERP5Type.Utils').declarePublic(
'getMessageIdForWorkflowState','getTranslationStringWithContext',
'getMessageIdWithContext' )
##################################################### #####################################################
# Globals initialization # Globals initialization
##################################################### #####################################################
...@@ -406,8 +418,9 @@ class TempDocumentConstructor(DocumentConstructor): ...@@ -406,8 +418,9 @@ class TempDocumentConstructor(DocumentConstructor):
# Make some methods public. # Make some methods public.
for method_id in ('reindexObject', 'recursiveReindexObject', for method_id in ('reindexObject', 'recursiveReindexObject',
'activate', 'setUid', 'setTitle', 'getTitle', 'activate', 'setUid', 'setTitle', 'getTitle',
'edit', 'setProperty', 'getUid', 'setCriterion', 'edit', 'setProperty', 'getUid',
'setCriterionPropertyList'): 'setCriterion',
'setCriterionPropertyList','manage_delObjects'):
setattr(TempDocument, '%s__roles__' % method_id, None) setattr(TempDocument, '%s__roles__' % method_id, None)
self.klass = TempDocument self.klass = TempDocument
......
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