[Pythonmac-SIG] Get the locale on OSX

Chris Van Bael chris.van.bael at gmail.com
Mon Dec 3 09:26:40 CET 2007


On Dec 3, 2007 8:40 AM, Nicholas Riley <njriley at uiuc.edu> wrote:
> On Sun, Dec 02, 2007 at 03:18:14PM +0100, Chris Van Bael wrote:
> > I'm trying to port an python application which runs fine on Windows
> > and Linux to OSX.
> > However, it seems "lang = locale.getdefaultlocale()[0]" doesn't work.
> > I've searched quite some bit on the Internet and on this mailinglist,
> > and apparently it is a problem, but I haven't found any solution for
> > it.
>
> What are you trying to do with the locale information?  Leopard's
> Terminal does have an option to 'set LANG environment variable on
> startup', which when checked does cause locale.getdefaultlocale() to
> work, but this is of no help in general.

Well,

it's for some educational games: Childsplay and Schoolsplay
(www.schoolsplay.org)
Based on the locale information, we choose different languages to use
in the strings and also different alphabet sound files.
We do have an commandline option to set the language, so "schoolsplay
--language=nl_BE" would give Dutch strings and sounds.
However the nicest option would be that it searched in the settings of the OS.
The program would be packed btw with py2app, so and end user wouldn't
have to use the Terminal (and install all Python dependencies).


More information about the Pythonmac-SIG mailing list