Call for volunteers [was: Re: Localization]

Dirk Hohndel dirk at hohndel.org
Sat Oct 13 09:23:58 PDT 2012


On Oct 13, 2012, at 6:47 AM, Mikko Rasa wrote:

> On 13.10.2012 16:30, Lubomir I. Ivanov wrote:
>> On 13 October 2012 16:00, Mikko Rasa<tdb at tdb.fi>  wrote:
>>> On 13.10.2012 15:25, Lubomir I. Ivanov wrote:
>>>> 
>>>> erm, i for instance am not a english native, yet prefer all my
>>>> software to be in english, while keeping a non-english locale.
>>>> looks like i have to use enviroment variables for subsurface to obey
>>>> that...but wait subsurface on windows may overwrite my env. variable
>>>> value by default, so i won't be able to do that...
>>> 
>>> Out of curiosity, what locale settings do you use?  LC_MESSAGES is the one
>>> that controls the language used for messages, so I assume you have that set
>>> to en_US or en_GB.  If other programs respect that but subsurface doesn't,
>>> then we're doing something wrong.
>>> 
>>> I use en_US.utf8 for most categories, but fi_FI.utf8 for LC_TIME and C for
>>> LC_COLLATE.
>>> 
>>> Windows also offers several categories for localization settings, though I'm
>>> not certain which one controls (or is supposed to control) the language.
>>> 
>> 
>> i only tried setting LC_ALL with putenv(..) within subsurface, but
>> from my tests on windows it seems that gettext is only interested in
>> the LANGUAGE env. variable, but
>> also the menu text are not translated.

This should work - I know that other programs do the same thing: they get the Windows language settings and then adjust the program's environment so that gettext sees the correct settings.

>> my main point here is that LC_* in the LANG, LANGUAGE env. variables
>> are not used at all by other windows software and users don't know
>> that they even exists.

Yes - Windows has its own APIs for this. And we need to use those to set up the environment for subsurface.

>> since these values don't exist, we have to force a value on subsurface
>> runtime for it to be translated. but if we force a value, how would
>> the user switch languages is completely beyond me.
>> i'm only seeing this ATM:
>> 
>> adding a command line option:
>> subsurface.exe -lang=xx_XX
>> 
>> and telling the user that he/she can use it to control the language.
> 
> The LC_* variables don't exist on Windows, because it uses a different method of retrieving the user's preferred language.  The relevant API call appears to be GetUserDefaultUILanguage.  If gettext doesn't use this on Windows, I'd consider it broken.  Unfortunately, it's probably still the best, or at least most widely known, choice.

Well, gettext tries to stay consistent between OSs. I think I could argue this both ways :-)
Anyway, we need to work with what we get and simply set things up correctly in windows.c

> Using putenv to set the locale is an ugly hack, but if gettext can't be coaxed to do the right thing, then so be it.

Why is this an ugly hack? You are just setting up the environment for one of the components of your software…

/D


More information about the subsurface mailing list