Commit 495359cd authored by Jérome Perrin's avatar Jérome Perrin

added support for default

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6333 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 77c8e2ab
......@@ -59,10 +59,12 @@ class Message(Persistent):
security = ClassSecurityInfo()
security.declareObjectPublic()
def __init__(self, domain = None, message = '', mapping = None,):
def __init__(self, domain = None, message = '',
mapping = None, default = None):
self.message = message
self.mapping = mapping
self.domain = domain
self.default = default
security.declarePublic('dump')
def dump(self):
......@@ -80,6 +82,7 @@ class Message(Persistent):
self.message = o.message
self.domain = o.domain
self.mapping = o.mapping
self.default = o.default
def __str__(self):
"""
......@@ -97,8 +100,13 @@ class Message(Persistent):
self.message = self.message.decode('utf8')
return self.message
else:
return translation_service.translate(self.domain, self.message, mapping=self.mapping, context=context).encode('utf8')
return translation_service.translate(self.domain,
self.message,
mapping=self.mapping,
context=context,
default=self.default
).encode('utf8')
InitializeClass(Message)
allow_class(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