[GRASS-dev] winGRASS: enabling non-english languages?
Markus Neteler
neteler at osgeo.org
Fri Jan 15 20:14:36 EST 2010
On Thu, Jan 14, 2010 at 8:51 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> Markus Neteler wrote:
...
>> 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%28VS.85%29.aspx
>
> A listing of the codes can be found at:
>
> http://msdn.microsoft.com/en-us/library/dd318693%28VS.85%29.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')
Perhaps instead of getdefaultlocale() a user selectable locale should be
implemented (see other email thread), say, from a list of available locales,
or at least non-english (whatever it is on the user's computer) and EN
locale.
> 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.
This works (of course). The point is that translations should be enabled
also for CMD line usage which requires as far as I understand a change
in Init.bat (?).
Markus
More information about the grass-dev
mailing list