Re: Setting i18n:domain to a variable

Josef Meile <[email protected]> Thu, 23 Nov 2006 22:33:40 +0100
Newsgroups gmane.comp.web.zope.page-templates
Message-ID <[email protected]>
Hi Henrique

Thanks for your reply, but ...

> Use tal:attributes to set the values:
>=20
> <h2 tal:define=3D"statusMessage python:request.get('statusMessage');
>                    domain python:request.get('domain')"
>        tal:attributes=3D"i18n:domain domain;
>                        i18n:translate string:">someText</h2>
it doesn't work either. Have you tested this? Anyway, I reduced the case=20
to this:

<html>
   <body tal:omit-tag=3D""
        tal:define=3D"domain python:request.get('domain','JMGui')">
     <div tal:replace=3D"domain"/>
     <h2 i18n:domain=3D"JMMessages" i18n:translate=3D"">Wrong selection</=
h2>
     <h2 tal:attributes=3D"i18n:domain domain;
                         i18n:translate string:">Wrong selection</h2>
   </body>
</html>


With the browser's language set to german and calling the template like=20
this: http://myurl/zptTemplate?domain=3DJMMessages

I get:

JMMessages
Ung=FCltige Auswahl
Wrong selection

So, the alternative you propose didn't execute the i18n directives, but=20
they are rendered in the html, which isn't really desired. This is what=20
you get when looking at the html source:

<html><head></head><body>JMMessages
     <h2>Ung=FCltige Auswahl</h2>
     <h2 i18n:domain=3D"JMMessages" i18n:translate=3D"">Wrong selection</=
h2>


</body></html>

So, I guess the "tal:attributes" directive only makes sense for real=20
html attributes and not for zpt directives (somebody correct me if I'm=20
wrong).

Regards,
Josef