Hi,
John ORourke wrote:
I looked into the following:
- POSIX - great idea, but info seems incomplete (eg. quote style,
units of weight), and updates depend on your *nix distro. Also dates
back to desktop days - the locale is set for a whole process, not ideal
in a web server environment. Speed of locale switching seems OK though.
The most important point of POSIX::setlocale() is that it changes
behaviors of existing functions. Error messages ($!) are automatically
localized, provided that the system supports the selected locale. When
you output floating point numbers, the correct floating point format
will be chosen.
Your CLDR idea is maybe not the worst, but then actually Perl should be
changed internally to use CLDR data, and ignore the OS hints. However,
for some topics like error messages this is not really possible.
Usually, the following approach works quite good for web applications or
server applications in general:
1) On startup try to guess a locale setting and change the locale using
POSIX::setlocale().
2) Let Perl (resp. the underlying libc) do the work for the categories
where this is already possible (OS error messages, decimal number
formats, collating, and so on).
3) If you need more locale specific data, simply integrate them in your
applications message catalogs for the specific locale, see
Locale::Maketex or Locale::TextDomain for details.
If 3) doesn't seem clean to you: Generate the message catalogs, resp.
the relevant part of the files from CLDR data.
Cheers,
Guido
--
Imperia AG, Development
Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.net/