Hi
This is my first post in the list, I'm working with Grok framework and
Jinja2 integration [1]. All seems to work really nice but I have an
issue that I can't figure out how to tackle.
As far I understand, with the i18n extension in Jinja, it's not
possible to use different domains translations in the same
Environment. am I right?
This is a common use case in Grok/Zope3, so I wrote a simple
Extension based on the i18n extension that use the Zope3 machinery to
do the translations. You could write something like this:
{% set i18n_domain = "some-domain" %}
{{ _("some-msgid") }}
What I can't figure out is this, in Grok/Zope3 we have something
called Messages and MessageFactory to work with i18n and different
domains translations.
in python, you could do:
_ = MessageFactory("some-domain")
...
...
variable = _("some-msgid")#Create a Message instance with domain "some-
domain"
Then, in the Zope Page Templates, you could write
<.... tal:content="view/variable" />
The ZPT parser will find out if the "view/variable" is an instance of
Message, and if it is, proceed to translate it.
(there are several ways to resolve the language, but the default one
it's from the Request object)
right now, if I write in a Jinja2 template
{{ view.variable }}
this is not translated, because a Message instance return it's msgid.
finally, the question:
Is there any way to write an Extension or something in order to
translate the view variables that are instance of Message ???.
Best Regards
[1] http://svn.zope.org/megrok.jinja/trunk/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---