Markus Neteler wrote:
> Are LANG or LC_MESSAGES set?
When defining these two variables manually on cmd line, the
Japanese translation comes up (working around the other
g.gui problems): the word "Help" is already translated.
It does not come up when starting the GUI from the
Windows menu (so, also here the variables are undefined).
Summary: these two variables are never defined in the
.bat files. Where should it go? Especially: how? I guess
that the current locale info needs to be fetched somehow
to define LANG/LC_MESSAGES properly.
Windows doesn't set these variables, and doesn't use the ISO 639
language codes or the ISO 3166 country codes.
You can retrieve the current user's locale from the registry key:
HKEY_CURRENT_USER\Control Panel\International\Locale
This will be a string (REG_SZ) value consisting of a hexadecimal
locale code. Or it can be retrieved (as an integer) via
GetUserDefaultLCID():
http://msdn.microsoft.com/en-us/library/dd318135(VS.85).aspx
A listing of the codes can be found at:
http://msdn.microsoft.com/en-us/library/dd318693(VS.85).aspx
Better still, a mapping from the Microsoft codes to Unix-style locale
names can be found in the windows_locale variable in Python's
locale.py.
In Python, you can call locale.getdefaultlocale(), which will return a
tuple of the LANG code and the Windows codepage, e.g.:
>>> import locale
>>> print locale.getdefaultlocale()
('en_GB', 'cp1252')
OTOH, trying to do this from within Init.bat is probably less than
ideal. The attached program (link with -lkernel32) queries the locale,
converts it to the Unix format and writes it to stdout.
--
Glynn Clements <glynn@gclements.plus.com>
(attachments)
winlocale.c (8.34 KB)