>From: "Sam Tregar" <[EMAIL PROTECTED]>
> > Or, is it customary to ask the user and do gettext based
> > upon their answer?
>
> Sorry, I don't.  Here's what I'd do if I needed to find out:

I did a lot of searching and reading. I think HTML::Template can be useful
when serving multi-lingual pages that are relatively static.  For something
more dynamic, maybe due to changing error messages. I found that there is a
Perl module Locale::Maketext[1] which does what "gettext"[2] while providing
some interesting flexibility.

For example, let's say I want to return "0 entries found," "1 entry found,"
or "2 entries found." With gettext I would have to have two lexicon elements
to accomodate negative, singular and plural forms. I would not include the
number with the text, therefore the number would always be emitted to the
left regardless of language. (Other languages may be more natural to say
"found 0 entries".)

Locale::Maketext lets you specify numbers as parameters to the lexicon. It
also has a method to determine negative, singular or plural and use the
correct word in the lexicon. Also, being written in Perl, I suppose it could
be used with mod-perl and made persistent. (Not sure).

Anyway, I hope I didn't stray too far off-topic with this feedback. I think
it could be useful to HTML::Template users because the resulting text from a
Locale::Maketext call could be substituted into a templates. This way
templates can be more easily used for multi-lingual purposes.

Additionally, I also learned it's better to ask the visitor which language
they prefer (rather than using the http header value). But, the http header
value can be used to make a best-guess about the language to use to ask them
which language they prefer. Also learned that UTF-8 encoding should be used
regardless of the language unless it is found there is not enough support
for the language, at which time you should maintain an association between
language codes and more specific character sets for the specific language.

[1]
http://search.cpan.org/~sburke/Locale-Maketext-1.06/lib/Locale/Maketext.pod
[2] http://www.gnu.org/software/gettext/gettext.html
For why gettext is limited, read this amusing story:
http://search.cpan.org/~sburke/Locale-Maketext-1.06/lib/Locale/Maketext/TPJ13.pod

Thanks!
Mark



-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to