Determine active OS langguage

Trevor DeVore lists at mangomultimedia.com
Wed Oct 5 14:03:55 EDT 2005


On Oct 5, 2005, at 10:51 AM, Scott Rossi wrote:

> Recently, Trevor DeVore  wrote:
>
>> Let me walk through the
>> logic of the function to see where it might be going wrong.
>> ...
>> get queryRegistry("HKEY_CURRENT_USER\Control Panel\International
>> \Locale") --> RETURNS HEX
>> get baseConvert(it,16,10) --> CONVERT HEX TO DECIMAL (1036 FOR FRENCH
>> STANDARD)
>> get it bitAND 1023
>
> 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?

-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com





More information about the use-livecode mailing list