[Tutor] l10n and Windows
Stéphane Brunet
stbru at teksavvy.com
Fri Jan 14 14:11:54 CET 2005
Hi,
After searching a while for a solution on the web and the archive of
this newgroups, I haven't found any answer to my questions... So here
are they...
Here is a command line session of Python on a Windows XP computer :
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getdefaultlocale()
('fr_CA', 'cp1252')
>>> locale.setlocale(locale.LC_ALL, '')
'French_Canada.1252'
>>> locale.setlocale(locale.LC_ALL, 'en_CA')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Python24\Lib\locale.py", line 379, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> locale.setlocale(locale.LC_ALL, 'English_Canada')
'English_Canada.1252'
>>> locale.getlocale()
['English_Canada', '1252']
>>>
The name of the default locale conform to RFC-1766
(http://www.faqs.org/rfcs/rfc1766.html) when returned by
locale.getdefaultlocale whereas setting the locale as 'en_CA' isn't
supported (on Windows).
Afterwards, locale.getlocale() isn't returning a "standard" RFC-1766
locale at all...
Is this a "feature" or a bug ? Where has portability gone ?
Moreover on the documentation on locale.getlocale(), it is written:
"""
Except for the code 'C', the language code corresponds to RFC 1766
"""
Thanks for you help.
Stéphane
More information about the Tutor
mailing list