Determine active OS langguage

Thierry Arbellot thierry.arbellot at laposte.net
Tue Oct 4 16:53:18 EDT 2005


For OSX, I use the following code. On new installation, the languages 
might not be defined, then read the globaldomain will return an error.

     put replaceText(shell("defaults read NSGlobalDomain 
AppleLanguages"),"(\s|\(|\))","") into languagesList
     if offset("AppleLanguages",languagesList) <> 0 then  -- error, 
domain AppleLanguages is not defined
       put replaceText(shell("defaults read NSGlobalDomain 
AppleLocale"),"(\s|\(|\))","") into languagesList
       if offset("AppleLocale",languagesList) <> 0 then  -- error, 
domain AppleLocale is not defined
         -- use a trick: get the localized name of the trash
         do "tell application" &&quote&"Finder"&quote &return& "get 
displayed name of trash" &return& "end tell" as appleScript
         put the result into theResult
         switch theResult
         case "Corbeille"  -- French
           put "French" into languagesList
           break
         case "Trash"  -- English
           put "English" into languagesList
           break
-- add any other language 
         default
           put empty into languagesList
         end switch
       end if
     end if

Thierry

On 2005, Oct 4, , at 21:26, Trevor DeVore wrote:

> Howdy folks,
>
> I need to find a way to determine the current language that is being 
> used by the OS (OS X, Win 98 >) so I can load the proper language file 
> for my application.  For example, if my app launches and Windows XP is 
> using a French interface, then I would load the French language file.
>
> Any ideas?
>
>
> -- 
> Trevor DeVore
> Blue Mango Multimedia
> trevor at mangomultimedia.com
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list