RE: [htmltmpl] language support
Brought to you by:
samtregar
From: Frederic H. <fre...@hu...> - 2004-08-24 19:44:53
|
Here's the solution I applied to this program in a project of mine. In my templates, I prefix my tokens with lang_. e.g.: <TMPL_VAR lang_address>, <TMPL_VAR lang_real_name>, etc... Then, I overloaded HTML::Template and used my own new method to which, on top of the usual HTML::Template parameters, I pass the language I want to use. In there, I loop through each template parameter, and if it starts with lang_, I look up the proper value in a dictionary system of my own. I also use the same functionality for capitalizing tokens. In that case, I suffix the tokens with _caps. That way, I can have only one template, and the graphic people can't really mess it up :) Hope that helps, Fred Hurtubise -----Message d'origine----- 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. |