l i v e c o d e

Getting Language Settings in Windows
Windows Only (Windows Only)

Recently a question was posted on the list about grabbing the language information of a Windows system. The following function should provide the four major language items of the target machine (watch line wrapping on the queryRegistry lines).

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
Note that this function accounts for the fact that many of the base system specs are stored in an INI file on non-NT Windows systems, instead of the registry.

Hope this is useful.

Posted 8/26/2002 by Scott Rossi to the MetaCard List   (See the complete post/thread)


 Print this tip

News and Rumors Products Services Developer Resources Contact STS About STS