[Pythonmac-SIG] Locale on MacOS 9

Francois Granger fgranger@altern.org
Mon, 21 Jan 2002 19:04:49 +0100


I am currently working on a multilinguale module. At the same time,
PythonCard team is starting to think about localisation. So I did some
search.

On MacPython ther is an emulation of locale. But it does not work exactly
the way I'd like ;-)

On Windows:

>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
 'French_France.1252'
>>> locale.getdefaultlocale()
 ('fr_FR', 'cp1252')

On the Mac:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'C'
>>> locale.getdefaultlocale()
(None, 'mac-roman')

Inside the file lib:locale.py line 303 it is said :

        To maintain compatibility with other platforms, not only the
        LANG variable is tested, but a list of variables given as
        envvars parameter. The first found to be defined will be
        used. envvars defaults to the search path used in GNU gettext;
        it must always contain the variable name 'LANG'.

Where the list is 'LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG'

I test defining os.envar before calling locale, but same answer.

Any idea where I can look for this ?