[Product-Developers] Re: plone.z3cform + i18n, how?

Mikko Ohtamaa mikko+plone at redinnovation.com
Thu Apr 30 08:27:52 UTC 2009


On Wed, Apr 29, 2009 at 6:03 PM, Gilles Lenfant
<gilles.lenfant at ingeniweb.com> wrote:
>
> Hi,
>
> There's an almost exhaustive howto on that subject here :
>
> http://projects.zestsoftware.nl/guidelines/guidelines/translations.html

A question regarding this:

msg = translate(_(u'msg_translatable', default=u'My translatable message'))

I think zope.i18n.translate assumes there is request.locale variable.
I am not sure where it is set, but it seemed to be missing in some
GetPaid context (translate() uses some magical acquisition behind the
scenes?). As a workaround we called context.translate()

See here:

http://groups.google.com/group/getpaid-dev/browse_thread/thread/3174e59daf712bf

+        # FIXME: This is an ugly hack that fixes certain strings not
translating since
+        # they're never rendered in template context
+        translate = lambda msg: getSite().translate(msgid=msg,
domain='plonegetpaid')
+

-Mikko




More information about the Product-Developers mailing list