How to get LOCALE_SNAME using JScript in TestComplete?

240 views Asked by At

Using JScript in TestComplete, how do I retrieve the locale name?

  1. Should I use GetLocaleInfo or GetLocaleInfoEx?

  2. It looks like the LOCALE_SNAME constant is not defined in TestComplete. What value should I pass instead?

I tried this code:

function GetTimeSettings()
{
  var rrr = Win32API.GetUserDefaultLCID();
  LOCALE_SNAME = rrr;
  Log.Message("Locale Name: " + GetLocaleInfoEx(LOCALE_USER_DEFAULT, LOCALE_SNAME));
}

but it throws the "Object expected" error.

1

There are 1 answers

0
Helen On
  1. Use aqEnvironment.GetLocaleInfo, or just GetLocaleInfo for short. It's a wrapper for the Windows API function GetLocaleInfo.

  2. The LOCALE_SNAME constant isn't defined in TestComplete; you need to define it manually:

    var LOCALE_SNAME = 0x0000005c;
    Log.Message(GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNAME));