Determine active OS langguage

Scott Rossi scott at tactilemedia.com
Wed Oct 5 14:33:08 EDT 2005


Recently, Trevor DeVore  wrote:

>> Without knowing exactly what you're doing, I think you may not need
>> the
>> bitAND portion of the code.  If you're using the MS provided tables of
>> locales and/or languages, you only need to get either decimal or
>> hex values.
>> In the localized projects I've worked on (sometimes 15 languages),
>> this was
>> all that was needed to determine language and locale of a system.
> 
> The Locale registry key returns the language identifier.  Since a
> language code is a combination of a primary language identifier and a
> sublanguage you have multiple entries for English, French, Chinese,
> etc.  For example there are language identifiers for the following
> entries for English:
> English (United States)
> English (United Kingdom)
> English (Australian)
> English (Canadian)
> English (New Zealand)
> English (Ireland)
> English (South Africa)
> English (Jamaica)
> English (Caribbean)
> English (Belize)
> English (Trinidad)
> 
> By using the bitAND operation I am extracting just the primary
> language identifier from the language identifer for which there is
> only one entry for each language.  Since I am loading an english,
> french, spanish, etc. stack with all of the translated strings this
> is exactly the information I want.  I just check the primary language
> and load the appropriate stack file.  If I didn't use bitAND then I
> would have to check that the language identifier was one of the 11
> different possible values for English.  Does this make sense?

It's been a long time since I did this but I think all you need to do is
grab the last two digits of the language identifier code.  If you look at
MS's table, you'll see that groups of related languages (such as English)
all end with the same two digits.  This was all I needed find to determine
primary language.  Just offering this as an option in case there's any issue
with your current code.

(Looking back through some code, I seem to recall there being one exception
for Chinese, but otherwise this tested out by a QA lab to be reliable for my
purposes.)

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list