Re: [htmltmpl] HTML::Template and Locale::Maketext
Brought to you by:
samtregar
From: Hugues de M. <hu...@ma...> - 2005-05-27 07:38:54
|
Hi, Just about <TMPL_xxx > tags in the template file: don't forget that you=20= can use H::T's 'filter' option and thus define your own syntax.=20 Personally, I've turned all the <TMPL_x > into a {%... %} notation, so=20= that '<TMPL_VAR NAME=3D"foo">' now reads '{%VAR NAME=3D"foo"%}' in my=20 templates. This works in Dreamweaver (at least a my translator's=20 version). As I suggested, you can use this kind of filter to "hide" calls to=20 maketext (or whatever localisation method) into a more web-designer=20 friendly way. For example you could use {{ ... }}=A0to hide <TMPL_VAR=20 EXPR=3Dmaketext('...')>. This could yield to: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <title>{{Hello, world!}}></title> </head> <body> <b>{{Hello, world!}}></b> <p>{{Welcome to this website.}}></p> <!-- We could use H::T variables to have things like this : --> <p>{{We have [quant,_1,visitor] today,, visitor_count}}></p> </body> </html> (definition of the filter is left as an exercise to the reader ;-) A a side effect, this can help the designer keep in mind that all text=20= chunks will be localised independently, so that he/she should avoid=20 things like: <TR> <TD>{{Do you want}}</TD> <TD>{{to}} <select name=3D"action"><option = value=3D"del">{{delete}}</option><option=20 value=3D"keep">{{keep}}</option></select> </TD> <TR> Where "to" would have to be translated using some unambiguous=20 correspondence which doesn't exist for every languages (at least for=20 French, this "to" would disappear - in other contexts, not). Best, Hugues PS: I know that this doesn't solve the cache issue, as template is=20 re-evaluated for every display, so that you should mix this approach=20 with Mark's caching modifications.= |