[Zope] Problems with i18n in Zope-2.12

Maciej Zięba krokodylek at tenbit.pl
Thu Apr 1 18:20:31 EDT 2010


Hi :-) 

I'm trying do develop a Zope-2.12 based application and I'm having problems 
with internationalizing it... :-/

The *.po files are OK it seems, as translating in ZPTs with i18n:translate 
works fine but I cannot get the translations to work in python code. How should 
that be done? I'm only just learning development on Zope-2.12, but I have some 
experience with Zope-2.10 and Plone-3

I've tried 2 approaches:

1. zope.i18nmessageid.MessageFactory, like this:

from zope.i18nmessageid import MessageFactory
_ = MessageFactory('MyDomain')
my_str = _(u'my_label', default=u'Some text')

This doesn't translate at all. my_str has 'my_label' value even though there 
is a default value.


2. zope.i18n.translate, like this

from zope.i18n import translate
translate(u'my_label', 'MyDomain', default=u'Some text')

This only translates the msgid to English and I want it to translate to Polish 
(I've tried in Polish version of Firefox, Konqueror and Arora).


What am I doing wrong? In the past I have used 1. in Plone-3 and it worked, so 
what has changed? Or maybe I'm missing some package?

Also if someone could point me to some good resources about i18n, that would 
be great.

I would be very grateful for any help or pointers.

Best regards,
MaciekZ


More information about the Zope mailing list