[ZPT] i18n in javascript

Clemens Robbenhaar robbenhaar at espresto.com
Fri Oct 31 17:16:24 EST 2003


Hi Santi,

 > I have a question about the use of i18n in ZPT.  Is there an easy way to
 > translate, for instance, an "alert" message in javascript using TAL an
 > ZPTInternationalizationSupport ?

 The problem with javascript and ZPT is that interpretation of
'tal:' expressions is suppressed inside <script> tags.
 I have not really tried it but I guess the same applies for
'i18n:' attributes.

 There are some principal reasons why this does not happen; the 'tal:'
stuff makes only sense inside XHTML and should not be abused to generate
non-XHTMLish stuff like javascript (or similar, I forgot the exact
argumentation). Makes sense from a theoretical point of view, but tends
to be a bit painful in practice. 

 > 
 > I have implemented my own translation system in zetadb
 > (http://zetadb.sourceforge.net) using a _(' ') syntax and doing the
 > translate change in the call method of my objects, using gnu gettext
 > modules and .po files.   Now I'm thinking to change to i18n zpt syntax,
 > just to join the way of zpt community, but I don't know how to translate
 > my javascript code this way.

 Well, as far as I know, the community uses DTML to generate
i18n-javascript, so You are possibly even ahead of the crowd, whatever
else You are doing ;-)

Cheers,
Clemens



More information about the ZPT mailing list