X-Git-Url: https://scm.cri.mines-paristech.fr/git/photoprint.git/blobdiff_plain/fbcbbb59f3bf16d329c9cf9b1295eaeb15ae040e..3f87de671d3ed1b8029efd733b10010d97a40e23:/utils.py?ds=sidebyside diff --git a/utils.py b/utils.py index 68b8c46..0982bc7 100755 --- a/utils.py +++ b/utils.py @@ -11,28 +11,21 @@ """ Global utilities -$Id: utils.py 651 2009-02-04 15:38:20Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/photoprint/trunk/utils.py $ + + """ from AccessControl import ModuleSecurityInfo -# TODO: trouver une solution… from zope.i18n import translate as i18ntranslate from zope.i18nmessageid import MessageFactory +from zope.globalrequest import getRequest security = ModuleSecurityInfo('Products.photoprint.utils') security.declarePublic('translate') -def translate(message, context): - """ Translate i18n message. - """ - # GTS = getGlobalTranslationService() - if isinstance(message, Exception): - try: - message = message[0] - except (TypeError, IndexError): - pass - return i18ntranslate(message, domain='photoprint', context=context.REQUEST) +def translate(msgid, mapping=None, default=None) : + """ traduction dans le domaine photoprint """ + return i18ntranslate(msgid, domain='photoprint', mapping=mapping, context=getRequest(), default=default) security.declarePublic('Message') Message = _ = MessageFactory('photoprint')