from zope.i18n import translate
translated_string = translate(_(u"N/A"), context=self.context)



Jean-Pascal Houde napsal:
Thanks, that's what I was suspecting.
Is there a way to do the translation in python? (I guess there must be
a way since the template engine does it, but I didn't find anything by
looking at the class or the attributes of the message)

On Apr 25, 6:17 pm, "Steve McMahon" <[EMAIL PROTECTED]> wrote:
I'm pretty sure that _(u'N/A') is creating a MessageFactory message
object. No translation is done at that point, as the target language
isn't known 'til page rendering.

These message objects are polymorphous, and if you concatenate one to a string:

_(u'N/A') + 'oops'

or even to another message, the result is a string -- not a message.

You need to do the concatenation in the page template.


--
Radim Novotny


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to