An alternative that I use:

In the template file, use a simple VAR tag,
<TMPL_VAR name="hello">

Store all the different language's text in a database or text files.

In the CGI, load the appropriate language based on input parameters or
cookie value,
my $lang = $cgi->param('lang') || 'en';
my $gui = load_gui ($lang);

Then load the text into the template,
$tmpl->param (hello => $gui->{hello});

You'll obviously have to write the load_gui sub yourself, depending on
how you store the data.

Carl


>>> Martin Sarfy <[EMAIL PROTECTED]> 24/08/2004 12:09:41 >>>

Hi folks,

I lack multiple language support in HTML::Template. 

My idea is that I wrote complete HTML page with tons of design
included
and then wrap pieces of text using e.g. 

        <TMPL_LANG lang="eng">Hello</TMPL_LANG>
        <TMPL_LANG lang="spa">Ciao</TMPL_LANG>
        <TMPL_LANG lang="cze">Ahoj</TMPL_LANG>

How do you solve this problem? 

Using <TMPL_IF lang=""> construct isn't appropriate for several
reasons:

  -- $lang is not accessible in <TMPL_LOOP> context

  -- it's too clumsy for manual writting

  -- <TMPL_IF> is not 'system' solution, it cannot handle e.g.
     substitution of similar languages or so.

Creating another copy of template file with translation is not 
maintainable because of changes in design.

Or should I use GNU gettext in some way?

Thanks a lot for advice


-- 
Martin Sarfy


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED] 
https://lists.sourceforge.net/lists/listinfo/html-template-users


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to