Prise en compte de la nouvelle signature de « translate » et prise en charge des...
[photoprint.git] / utils.py
1 # -*- coding: utf-8 -*-
2 ############################################################
3 # Copyright © 2008 Benoît PIN <benoit.pin@ensmp.fr> #
4 # Plinn - http://plinn.org #
5 # #
6 # This program is free software; you can redistribute it #
7 # and/or modify it under the terms of the Creative Commons #
8 # "Attribution-Noncommercial 2.0 Generic" #
9 # http://creativecommons.org/licenses/by-nc/2.0/ #
10 ############################################################
11 """
12 Global utilities
13
14
15
16 """
17
18 from AccessControl import ModuleSecurityInfo
19 from zope.i18n import translate as i18ntranslate
20 from zope.i18nmessageid import MessageFactory
21 from zope.globalrequest import getRequest
22
23 security = ModuleSecurityInfo('Products.photoprint.utils')
24
25 security.declarePublic('translate')
26 def translate(msgid, mapping=None, default=None) :
27 """ traduction dans le domaine photoprint """
28 return i18ntranslate(msgid, domain='photoprint', mapping=mapping, context=getRequest(), default=default)
29
30 security.declarePublic('Message')
31 Message = _ = MessageFactory('photoprint')