Re: [htmltmpl] RFC: Persistent or 2-stage evaluation
Brought to you by:
samtregar
From: Mathew R. <mat...@re...> - 2005-01-19 03:08:12
|
> The three things I've found that make multi-language processing = difficult > with H::T are: >=20 > 1. One-time evaluation of a template's page-specific vars (so that > subsequent displays can deal only in truly variable evaluations). > 2. No way to say <tmpl_include name=3D"constant_text_<tmpl_var = name=3DLANG>"> to > use language-specific text determined at run time. > 3. No way to recurse variables which may have been evaluated with text = that > contains variables. >=20 > #2 and 3 are troubling because, if I can't pull in fragments of a page = (for > a language), then I'm likely to use "Locale::Maketext" to provide me = with > what may be lengthy fragments. If the fragments contain markup (like a > link), then I'm stuck because the fragment's link will contain an = attribute: > "title=3D<TMPL_VAR NAME=3DLINK_TITLE_TEXT>" which will not be = evaluated. >=20 > Feeding ->output back into new H::T objects can get around a lot of = this. It > would be a lot easier if those 3 features were available. They don't = seem > like they would require too much kludging. FWIW, the company I work for uses H::T for page generation, and we = handle an arbitrary number of languages. Currently we have the product = translated into 4 different languages, and we have two more on the way. = H::T is used in combination with the Locale::MakePhrase package.... = however, I use a modified H::T.... The reason that I made a custom package of H::T was that the only = solutions that I could see to make language translations work was: a) provide a different template for each language, then use the = appropriate one based on users' language b) use H::T::E with a callback function so that static template strings = could run though the translation engine b) modify H::T so that it supports custom TMPL_xxx tags so that static = template strings could run through the translation engine Points (a) and (b) require no changes to H::T, and I can say from = experience that it works reasonably well. However, I found: <TMPL_VAR EXPR=3D"catalog('some static string')">=20 to be more nasty than: <TMPL_CATALOG "some static string"> so I chose to modify H::T. In the process, I added some extra features = to H::T. If you need more info on how I do language translations, let me know... Mathew |