Trouble with getdefaultlocale on Mac

Pierre-Alain Dorange pdorange at pas-de-pub-merci.mac.com
Thu Nov 6 17:18:25 EST 2008


Hello,

To internationalize a small game, i'm trying to use
locale.getdefaultlocale() or locale.getlocale().

On my Mac at home, it return '(none,xxx)' difficult to determine the
user language... 
At home : MacOS X 10.4.11 / Python 2.5.2 (user install, default was
2.3.2).

I try with the original system version (2.3.2) it was the same.
I also try to set defautl before (locale.setlocale(LC_ALL,''), do not
change anything.

>>> import locale
>>> locale.getdefaultlocale()
(None, 'mac-roman')
>>> locale.getlocale(locale.LC_ALL)
(None, None)

The same test at my office, with MacOS X 10.5 / Python 2.5.x return the
right answer ; 
('fr_FR','mac-roman')

My goal is to dertermine th user language define on the running system,
any helps ?

-- 
Pierre-Alain Dorange

Ce message est sous licence Creative Commons "by-nc-sa-2.0"
        <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/>



More information about the Python-list mailing list