[sword-devel] swlocale question

Manfred Bergmann bergmannmd at web.de
Fri Sep 4 01:22:43 MST 2009

On 04.09.2009, at 08:59, Matthew Talbert wrote:

>> Unfortunately on OS X the LANG var doesn't seem to get set also not  
>> any
>> other environment variable that would help determine the system  
>> language.
>> In OS X system preferences you have a preferred list of languages.  
>> The first
>> one is used as current system language but this is not reflected to  
>> terminal
>> environment.
>> Since SWORD library is not available as installable package on OS X  
>> like on
>> Linux we package a compiled binary of it including the locales.d  
>> folder and
>> look manually if there is a locale file for the current system  
>> language.
>> Hmm, looks like MacSword has to further do it's own thing here.
> We don't want to mess up what you're already doing. What format is the
> current system language in? This isn't a proposal to change SWORD to
> look at environment variables, but just to be a little smarter parsing
> language formats. If OS X returns the current system language in a
> format that even starts with the first 2 characters matching a locale
> in SWORD, this code would allow you to just pass that directly to
> SWORD without matching a SWORD locale precisely.

What I said wasn't quite right.
We set a custom locale dir with LocaleMgr::loadConfigDir().
The language format I can get from the system can be something like:  
"es_ES_PREEURO" or just the language code like "es".
So your snipped would work here too if the former format is reduced to  
5 characters.
What happens if the current system language is not available in SWORD  
or if none is manually set? Then I guess english will be taken as a  


More information about the sword-devel mailing list