Language

Scott Rossi scott at tactilemedia.com
Mon Aug 26 14:43:00 EDT 2002


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.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the metacard mailing list