> Hi Morten,

Hi Leonard,

> On Tue, May 31, 2011 at 13:19,  <li...@nidelven-it.no> wrote:
>> Hi,
>> I have a oldschool style Zope 2 product, which has an i18n
>> directory containing translations.
>> Using i18n:domain="SimpleChat" in this product works fine in
>> the page templates,
> Well, ZPTs generate message objects automatically from translated
> content, but they also explicitly translate all the message objects
> they get during interpolation between the literal parts of the
> template and the dynamically generated ones.
>> but when I start translating text in
>> a Python module using _("Translate me") I just get English
>> text (instead of Norwegian, which is what I want).
> When you say "I just get English text", what does exactly "get" mean
> in terms of code?
> Mind you, if you simple call unicode(message) you'll most likely only
> get the English version back. Same thing if you do:
>   u"some other string: %s" % message
> To get an actual translation, you need to call
> zope.i18n.translate(message), eventually passing the
> "target_languate=..." parameter.
> Take a look at the zope.i18n module for details, specifically the
> translate() and negotiate() functions.

OK.  Well I have this function now:

def _(msgid, request):
    language = request['LANGUAGE']
    return translate(msgid, domain='SimpleChat', target_language=language)

Which sends all the relevant bits to the translate function.  But, this
doesn't work either, and I can see it is because the interpolate function
call is used in translate.

So do I need to setup some utility?


Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to