davidfilmer has asked for the wisdom of the Perl Monks concerning the following question:
What I'm presently thinking is that I won't hard-code any output in my script, but will populate (from a database or whatever) a hash which would look this:
$lang{'yes'} = 'sí';
$lang{'no'} = 'ningún';
$lang{'The answer is'} = 'La respuesta es';
Then, in my script, I would output something like:
print "$lang{'The answer is'} $lang{'yes'}.";
and it would print:
La respuesta es sí.
assuming I had populated the hash from a Spanish database. (In the English version, the hash values are simply the same as the hash keys.)
Does this seem a good approach? It seems a bit clumsy, but a better idea doesn't come to mind (though I can think of a couple of ideas that I think are much worse). A better suggestion would be most welcome!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Language Localization (l18n, L10n) - Multilingual Output
by adrianh (Chancellor) on Aug 01, 2003 at 22:01 UTC | |
Re: Language Localization (l18n, L10n) - Multilingual Output
by waswas-fng (Curate) on Aug 01, 2003 at 22:06 UTC |