views:

83

answers:

1

We're currently writing a web application based on a threaded python web server framework (cherrypy) and would like to simultaneously support users from multiple locales.

The locale module doesn't appear to be thread safe. Are there 3rd party libraries or modules that provide locale parsing and formatting functionality in a thread-safe way?

Suggestions appreciated!

Regards, Malcolm

A: 

pyIcu has some such functionality (and other great support for i18n/l10n tasks), and I've been using it some of the time, but it's far from a smooth port of locale-based code -- you'll basically have to rewrite your code for it. Also, it doesn't support environments where you're not allowed to install arbitrary extensions, such as App Engine and some other hosted environments. Unfortunately I don't know of a good alternative without such constraints:-(.

Alex Martelli
Thanks for the link to the pyICU library and the heads-up on the C library dependency. I enjoyed your "Python in a Nutshell" book (pretty cool receiving a reply from the author!).
Malcolm
@Malcolm, you're welcome (though I do agree with @John's comment on your Q!-). I do wish `locale` was more multiprocessing-friendly, ah well.
Alex Martelli
@Alex: I've corrected my boorish behavior - all my prior questions show accepted answers. Thanks again for your help.
Malcolm