Hi,
I have a problem with i18n message factories in python files. Perhaps
there's something I don't understand correctly.

I'm creating a website with PloneGetPaid and trying to add some
translations to PGP. Basically, what I noticed is that if I do the
following in a view:

    def test(self):
        return _(u'N/A')

    def test2(self):
        return _(u'N/A') + 'oops'

... and I try to call it from a page template :
<div tal:content="view/test" />
<div tal:content="view/test2" />

Only the first string is translated correctly. It seems like the
translation is actually occuring during the page template rendering,
and not in the python script (print _(u'N/A') doesn't work either --
no translation is done). Since the test2 does not return the i18n
message itself, but the message with a string appended to it, it's not
translated at all.

I'm not sure if this behavior is normal... That's problematic if you
need to create a message from the python script using several message
strings, such as "... %s ... %s" % (_(u'message_1'), _(u'message_2'))
In this case message_1 and message_2 are not translated.

That's not the first time I'm seeing this problem. It also happened
with another project I did, but I worked around it... Am I doing
something wrong?

Thanks,

Jean-Pascal

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

Reply via email to