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):
if kw.get('tuple'):
return path.split('/')
return path
def int2letters(i):
"""
Convert an integer to letters, to generate spreadsheet column id
A, B, C ..., Z, AA, AB, ..., AZ, BA, ..., ZZ, AAA ...
"""
if i < 26:
return (chr(i + ord('A')))
d, m = divmod(i, 26)
return int2letter(d - 1) + int2letter(m)
# Get Message Id for Workflow State
def getMessageIdForWorkflowState(title, workflow_id):
return '%s [state in %s]' % (title, workflow_id)
def getMessageIdWithContext(msg_id,context,workflow_id):
return '%s [%s in %s]' % (msg_id,context, workflow_id)
def getTranslationStringWithContext(self,msg_id, context, context_id):
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
#####################################################
......@@ -406,8 +418,9 @@ class TempDocumentConstructor(DocumentConstructor):
# Make some methods public.
for method_id in ('reindexObject', 'recursiveReindexObject',
'activate', 'setUid', 'setTitle', 'getTitle',
'edit', 'setProperty', 'getUid', 'setCriterion',
'setCriterionPropertyList'):
'edit', 'setProperty', 'getUid',
'setCriterion',
'setCriterionPropertyList','manage_delObjects'):
setattr(TempDocument, '%s__roles__' % method_id, None)
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