[Pythonmac-SIG] Locale on MacOS 9

Kevin Altis altis@semi-retired.com
Thu, 24 Jan 2002 09:08:30 -0800


It would be much better for someone to really fix locale otherwise Mac
programs won't have the date, currency, number separators, calendar and day
names, etc. I know the Mac libraries have all that info and a lot of
international functions since I used to use it in my code, but I no longer
have my copies of Inside Mac or the code, plus I'm sure the library and
functions calls changed with OS X...

Anyone interested in fixing locale should look at:
http://www.python.org/doc/current/lib/module-locale.html

However, just having the language and country code would at least help if
all you needed was to be able to handle basic string localization.

ka

> -----Original Message-----
> From: pythonmac-sig-admin@python.org
> [mailto:pythonmac-sig-admin@python.org]On Behalf Of Francois Granger
> Sent: Thursday, January 24, 2002 1:50 AM
> To: pythonmac-sig@python.org
> Subject: Re: [Pythonmac-SIG] Locale on MacOS 9
>
>
> on 23/01/02 23:55, Jack Jansen at Jack.Jansen@oratrix.nl wrote:
>
> > If someone wants to put some effort into getting the locale
> > module to work on MacOSX (and maybe even OS9: I think the APIs
> > are available there too) that would be very welcome.
>
> I wonder how difficult it is for MacOS 9 if the only aim is getting the
> language and country code instead of 'none' as an answser to
> locale.getdefaultlocale().
>
> I don't know where to look in the rich MacPython lib for a way to get the
> MacOS language and country ?
>
> A stupid proposal in the mean time could be to insert the
> following at line
> 326 of lib:locale.py
>
>         elif sys.platform == "mac":
>             import os
>             for variable in ['LANGUAGE', 'LANG']:
>                 localename = os.environ.get(variable,None)
>                 if localename is not None:
>                     break
>             if localename is not None:
>                 code = localename
>
>
> This allow one to do in his own script:
>
> os.environ['LANGUAGE'] = 'fr_FR'
> lang, encoding = locale.getdefaultlocale()
>
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>