On Oct 6, 2005, at 12:30 AM, graham samuel wrote:

More significantly the 'queryregistry' call doesn't happen in your script because it would only be called if the platform **wasn't** Win32, which it is! I altered the logic a bit so that the registery is queried for the Win32 case, and bingo! I got 'fr'. So the key idea works. Don't know what the replaceText problem is.

Doh, I was testing something right before uploading the stack and forgot to switch the script back so it was testing the platforms correctly. Sorry about that. I'm glad to hear it did work once you switched it yet. I had entered the incorrect codes for German and Italian in the script I posted so I've updated the stack in my user space (trevordevore). Here is the latest function for anyone who cares. I added a couple of extra languages to it as well.


--
Trevor DeVore
Blue Mango Multimedia
[EMAIL PROTECTED]


/**
* Returns the two letter language code that a program can use to load a language file.
*
* @return 2 letter lang
*/
function getUserLang
    local tAppLangs = "en,fr,de,es,it,pt,zh,zh,ja,ko"
--> English,French,German,Spanish,Italian,Portuguese,Chinese,Chinese,Japanes e,Korean
    --> CHINESE APPEARS TWICE FOR SIMPLIFIED AND TRADITIONAL (MAC OS X)
    --> zh-Hans = simplified chinese
    --> zh-Hant = traditinoal chinese
    local tUserLangs,tLangs
    local i

    set wholeMatches to true

    if platform() is "MacOS" then
        put "en,fr,de,es,it,pt,zh-Hans,zh-Hant,ja,ko" into tLangs
        get "(\s|\(|\)|"&quote&")"
put replaceText(shell("defaults read NSGlobalDomain AppleLanguages"),it,"") into tUserLangs

    else if platform() is "Win32" then
        put "9,12,7,10,16,22,4,4,17,18" into tLangs
put queryRegistry("HKEY_CURRENT_USER\Control Panel \International\Locale") into tUserLangs
        put baseConvert(tUserLangs,16,10) bitAND 1023 into tUserLangs

    --> LINUX
    else

    end if

    repeat for each item tLang in tUserLangs
        put itemOffset(tLang, tLangs) into i
        if i > 0 then exit repeat
    end repeat

    if i > 0 then return item i of tAppLangs
    else return "en"
end getUserLang



_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to