perl-i18n

[perl-i18n] Perl locale information sources for server apps, and the CLDR

2007-07-02 08:27:13
Hi folks, sorry this is a bit long!

[ summary: just got into i18n and unicode, not happy with sources of locale information and wondering about use of CLDR, considering writing a Perl module for it ]

I've just successfully ported my large web application (yet-another-template-system) to support end-to-end unicode and full i18n.

However I can't bring myself to use any of the existing locale-information modules - nothing feels 'comfortable' from a commercial and technical point of view. The basic issue is that we need the application itself to run in a 'neutral' locale - ie. running perl without 'use locale', but each web request needs access to locale information specific to the request.

What modules are people using out there and how happy are you?

The things I look at are:
- update frequency (world events like expansion of the EU need to be implemented soon after the event)
   - reliability (most CPAN modules are "use at your own risk" of course)
   - consistency (some differences between each locale system)
   - localised names (country and currency names in native languages)

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.

- Locale::Object - nice interface, uses a SQLite data file but looks like maintenance is "as and when", and the database schema is undocumented. The 'make_sane' idea is great - given a country, it finds a suitable language and currency if current values are invalid.

- Locale::Constants - again update method is unknown but nice, simple interface

- DateTime::Locale - looks like Dave Rolsky had the same problems and wrote his own locale files as separate modules, so DateTime has its own Locale and Timezone data, which may or may not match your system locales. Even so this is a nice module, especially the Storable hooks.

I looked around for sources of this data, and found the Unicode CLDR, but I was surprised to see no CPAN modules for it! The files have just about all data you could want, and the format is properly defined XML, and updates are organised, regular, and vetted. See http://unicode.org/cldr/process.html

I am thinking about creating the following:
1 - a Perl module which allows CLDR data files to be queried in many ways 2 - a script to update the system's POSIX locale data from the CLDR so all your other apps can benefit. 3 - a web service with free and commercial options, which provides the latest CLDR data - the Perl module could be told to use this or local files

Any comments before I set off down this road?  Anybody want to contribute?

cheers
John O'Rourke
Versatilia Ltd

<Prev in Thread] Current Thread [Next in Thread>