Determine active OS langguage

Ken Ray kray at sonsothunder.com
Tue Oct 4 16:36:02 EDT 2005


On 10/4/05 2:26 PM, "Trevor DeVore" <lists at mangomultimedia.com> 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?

Well, for Windows, Scott Rossi posted a function to get that information
(watch line wraps):

function langSpecs
  # THIS FUNCTION RETURNS 4 LINE ITEMS:
  # COUNTRY DESIGNATION
  # 3 CHAR LANGUAGE CODE
  # 8 CHAR LOCALE HEX CODE
  # 4 CHAR LOCALE DECIMAL CODE
  if word 1 of systemVersion() = "Windows" then
    put url ("file:" & specialFolderPath(system) & "/win.ini") into tSystem
    set itemDel to "="
    put item 2 of line (lineOffset("sCountry",tSystem)) of tSystem & cr
after tData
    put item 2 of line (lineOffset("sLanguage",tSystem)) of tSystem & cr
after tData
  else
    put queryRegistry("HKEY_CURRENT_USER\Control
Panel\International\sCountry") & cr after tData
    put queryRegistry("HKEY_CURRENT_USER\Control
Panel\International\sLanguage") & cr after tData
  end if
  put queryRegistry("HKEY_CURRENT_USER\Control Panel\International\Locale")
& cr after tData
  put baseConvert(line 3 of tData,16,10) after tData
  return tData
end langSpecs

For OS X, check out Alex Rice's post on the subject:

http://lists.runrev.com/pipermail/use-revolution/2002-December/010238.html


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list