X-Git-Url: https://svn.cri.ensmp.fr/git/photoprint.git/blobdiff_plain/3619e9abcedd109fe262127dd53e8af716025391..4108abadea5456a9d832614c32b93925425f6904:/utils.py diff --git a/utils.py b/utils.py index b3fc3c7..0982bc7 100755 --- a/utils.py +++ b/utils.py @@ -16,23 +16,16 @@ Global utilities """ 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')