Thankyou to Antonios Christofides, Martijn van den Burg and Jody Biggs
who all had very valuable sugessitions.
>From the responses though, i take it that HTML::Template does not
inheriently have any language support.
I was hoping that HTML::Template had some internally supported
mechanism, so that we could when we load a template file, let it know
the location of our "Language data file" and then at run-time, run
something like:
my $template = new HTML::Template(file => 'test.tmpl', ...)
$template->languageFiles(directory => '/path/to/data/files');
$template->setLanguage(language => 'en-au', guess => 1);
# implying that if a translation is not found for
'en-au' then try 'en', etc...
$template->output();
and in 'test.tmpl' then we could simply do things like:
<tmpl_lang>Error Message Follows</tmpl_lang>
and HTML::Template would take care of the rest of it for us.
Do people think that the above functionality would be useful anyway?
Sam, do you think it would be good to provide such a feature as part of
the core, of so, i can look at doing a patch for HTML::Template.
Personally, i think such a thing would be great... at least for the
simple language stuff (which is what 90% of us would use) and enable our
template to be multi-lingual with only the following changes required:
* 'tmpl_lang' tags where we want translations to occur
* very simple code changes to say which language you want to output in
* data files will need to be created by the user mapping codes/tags to
the language specific mappings...
simran.
On Thu, 2002-06-06 at 19:07, Antonios Christofides wrote:
> Hi, simran. Here's how I've handled the problem in
> http://www.itia.ntua.gr/ and http://www.meteo.ntua.gr/, sites provided
> in English and Greek.
>
> My templates do not have messages, but only variables. For example, no
> template says
>
> <h2>Research projects</h2>
>
> Instead, I have
>
> <h2><tmpl_var name=Research_projects></h2>
>
> More precisely, since my templates get messed up with too many
> variables, I'm using a filter to convert $Variable into
> <tmpl_var name=Variable>, thus my template actually says
>
> <h2>$Research_projects</h2>
>
> Thus, I have only one set of templates for all languages. It is the
> Perl script's responsibility to make the correct assignments to the
> message variables.
>
> Where are the actual strings stored? I've used two different methods
> for the two web sites. One method is store them into the database. I
> have the following table:
>
> CREATE TABLE tblStrings
> (StringId INTEGER NOT NULL,
> Text_el TEXT,
> Text_en TEXT,
> PRIMARY KEY (StringId));
>
> (One might prefer (StringId, LanguageId, text), which is more
> scalable.)
>
> I have found this to be a good method. One of its advantages is that
> the strings are managed by the software we have in order to enter data
> into the database. Thus, users of that software are able to alter the
> strings, and not only web developers or template designers. However,
> this is on a MySQL which runs on the web server, so it's relatively
> fast, light, and reliable. But for the other web site, which uses a
> remote Oracle server, I wanted to limit database access, and I used
> files: I have a directory named "strings", which contains directories
> "el" and "en", which contain files, one file for each message, the
> file name being the string id. Not the coolest way, but it works.
>
> That's the most part of it. I'm not going into more details, but you
> can e-mail me for further questions.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]