[ZPT] Re: Setting i18n:domain to a variable
Josef Meile
jmeile at hotmail.com
Thu Nov 23 16:33:40 EST 2006
Hi Henrique
Thanks for your reply, but ...
> Use tal:attributes to set the values:
>
> <h2 tal:define="statusMessage python:request.get('statusMessage');
> domain python:request.get('domain')"
> tal:attributes="i18n:domain domain;
> i18n:translate string:">someText</h2>
it doesn't work either. Have you tested this? Anyway, I reduced the case
to this:
<html>
<body tal:omit-tag=""
tal:define="domain python:request.get('domain','JMGui')">
<div tal:replace="domain"/>
<h2 i18n:domain="JMMessages" i18n:translate="">Wrong selection</h2>
<h2 tal:attributes="i18n:domain domain;
i18n:translate string:">Wrong selection</h2>
</body>
</html>
With the browser's language set to german and calling the template like
this: http://myurl/zptTemplate?domain=JMMessages
I get:
JMMessages
Ungültige Auswahl
Wrong selection
So, the alternative you propose didn't execute the i18n directives, but
they are rendered in the html, which isn't really desired. This is what
you get when looking at the html source:
<html><head></head><body>JMMessages
<h2>Ungültige Auswahl</h2>
<h2 i18n:domain="JMMessages" i18n:translate="">Wrong selection</h2>
</body></html>
So, I guess the "tal:attributes" directive only makes sense for real
html attributes and not for zpt directives (somebody correct me if I'm
wrong).
Regards,
Josef
More information about the ZPT
mailing list