Map Linux locale codes to Windows locale codes?

2010-12-14 Thread python
Is there a way to map Linux locale codes to Windows locale codes?

Windows has locale codes like 'Spanish_Mexico'. We would like to
use the more ISO compliant 'es_MX' locale format under Windows.

Is there a resource or API that might help us with this mapping?

Babel is not an option for us since we're using Python 2.7.

Thank you,
Malcolm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Map Linux locale codes to Windows locale codes?

2010-12-14 Thread Flávio Lisbôa
You could look into the windows registry, the key
HKLM\SYSTEM\CurrentControlSet\Control\Nls has all the supported LCID's
listed. If not, you could simply get the codepage provided by
locale.setlocale(), e.g.:

import locale
print(locale.setlocale(locale.LC_ALL, ))

prints Portuguese_Brazil.1252 for me. That codepage part is actually a
LCID, that you can then cross-reference with any LCID list on the net. I
guess there may be a way to look that up entirely from the registry,
including getting a short reference or ANSI codepage from the LCID, but i
doubt it'd be portable at all.

Maybe what you should do is to make up a dict with known LCID's and their
corresponding language codes. I don't know of any way to do this
automatically in python...

Take a look at http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx

2010/12/14 pyt...@bdurham.com

 Is there a way to map Linux locale codes to Windows locale codes?

 Windows has locale codes like 'Spanish_Mexico'. We would like to use the
 more ISO compliant 'es_MX' locale format under Windows.

 Is there a resource or API that might help us with this mapping?

 Babel is not an option for us since we're using Python 2.7.

 Thank you,
 Malcolm

 --
 http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list