Re: [htmltmpl] language support
Brought to you by:
samtregar
From: Martin S. <sa...@ic...> - 2004-08-24 19:23:59
|
On Tue, Aug 24, 2004 at 12:07:32PM -0400, Sam Tregar wrote: > On Tue, 24 Aug 2004, Martin Sarfy wrote: > > > Using <TMPL_IF lang=""> construct isn't appropriate for several reasons: > > > > -- $lang is not accessible in <TMPL_LOOP> context > > Use global_vars and it will be. It's good that global_vars is not set by default, clean namespace in <TMPL_LOOP> is advantage and I don't want to turn it on only because translations. > > -- it's too clumsy for manual writting > > I don't understand what you mean by this. If you consider > HTML::Template's syntax to be too clumsy then why are you using it? Syntax is perfect because many designers are able to learn it and work of programmer and designer can be splitted, now I'm talking about work of translator, who needs some easy to understand/use syntax, he cannot write <TMPL_IF VAR="lang"> logic for every label he wants to translate. > > -- <TMPL_IF> is not 'system' solution, it cannot handle e.g. > > substitution of similar languages or so. > > You can handle that in your code. I'm certainly not going to add an > exhaustive list of languages and their synonyms to HTML::Template! > > > Or should I use GNU gettext in some way? > > Possibly. I've seen it used in similar situations, but I've never > used it myself. I can't imagine how to use it, how to enclose string in template file and how to call gettext() function (this has to be called from within HTML::Template code). I think ability to write templates in several languages is common requirement, so common that built-in support in templating engine should be considered. -- Martin Sarfy |