Trouble with getdefaultlocale on Mac

Pierre-Alain Dorange pdorange at
Thu Nov 6 23:18:25 CET 2008


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

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 ; 

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"

More information about the Python-list mailing list