Résolu : problème de localisation avec zope-2.12.
authorBenoît Pin <benoit.pin@gmail.com>
Tue, 26 Oct 2010 14:19:07 +0000 (16:19 +0200)
committerBenoît Pin <benoit.pin@gmail.com>
Tue, 26 Oct 2010 14:19:07 +0000 (16:19 +0200)
utils.py

index 3344d57..68b8c46 100755 (executable)
--- a/utils.py
+++ b/utils.py
@@ -17,7 +17,7 @@ $URL: http://svn.luxia.fr/svn/labo/projects/zope/photoprint/trunk/utils.py $
 
 from AccessControl import ModuleSecurityInfo
 # TODO: trouver une solution…
 
 from AccessControl import ModuleSecurityInfo
 # TODO: trouver une solution…
-#from Products.PageTemplates.GlobalTranslationService import getGlobalTranslationService
+from zope.i18n import translate as i18ntranslate
 from zope.i18nmessageid import MessageFactory
 
 security = ModuleSecurityInfo('Products.photoprint.utils')
 from zope.i18nmessageid import MessageFactory
 
 security = ModuleSecurityInfo('Products.photoprint.utils')
@@ -32,8 +32,7 @@ def translate(message, context):
                        message = message[0]
                except (TypeError, IndexError):
                        pass
                        message = message[0]
                except (TypeError, IndexError):
                        pass
-       return message
-       return GTS.translate('photoprint', message, context=context)
+       return i18ntranslate(message, domain='photoprint', context=context.REQUEST)
 
 security.declarePublic('Message')
 Message = _ = MessageFactory('photoprint')
 
 security.declarePublic('Message')
 Message = _ = MessageFactory('photoprint')