Description
The GetLocaleInfo
method lets you retrieve various information about system and user locales, for example, regional and language options specified in the Control Panel. To change the locale parameters, use the SetLocaleInfo
method.
The GetLocaleInfo
method is a wrapper over the Windows API function of the same name. Therefore, it is recommended to call it explicitly with the aqEnvironment.GetLocaleInfo
code line. For more information about using this method, see the description of the GetLocaleInfo
function in the MSDN library.
Declaration
aqEnvironment.GetLocaleInfo(Locale, Type)
Locale | [in] | Required | Integer | |
Type | [in] | Required | Integer | |
Result | String |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameters:
Locale
Identifier of the locale whose parameter you want to get. This parameter supports the LOCALE_NNN
locale identifier constants defined in the Win32API
object. For example, LOCALE_USER_DEFAULT
stands for the user’s default locale.
For a list of the supported locale identifier constants, see the description of the Locale parameter in the article about the GetLocaleInfo
function in the MSDN library.
Type
The identifier of the locale’s parameter that you want to get. This parameter can be one of the LOCALE_NNN
locale information constants defined in the Win32API
object. For example, LOCALE_SDECIMAL
stands for the decimal separator in numbers.
For a full list of the supported constants, see the section “Constants Used in the LCType Parameter of GetLocaleInfo, GetLocaleInfoEx, and SetLocaleInfo” in the Locale Information Constants article of the MSDN library.
Result Value
A string holding the value of the specified parameter.
Example
The following example logs the user’s time settings, which are specified in the Regional and Language Options in Control Panel:
JavaScript, JScript
function GetTimeSettings()
{
Log.Message("Time format: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT));
Log.Message("Time separator: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME));
Log.Message("AM symbol: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159));
Log.Message("PM symbol: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359));
}
Python
def GetTimeSettings():
Log.Message("Time format: " + str(aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT)))
Log.Message("Time separator: " + str(aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME)))
Log.Message("AM symbol: " + str(aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159)))
Log.Message("PM symbol: " + str(aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359)))
VBScript
Sub GetTimeSettings
Log.Message "Time format: " & aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT)
Log.Message "Time separator: " & aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME)
Log.Message "AM symbol: " & aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159)
Log.Message "PM symbol: " & aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359)
End Sub
DelphiScript
procedure GetTimeSettings;
begin
Log.Message('Time format: ' + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT));
Log.Message('Time separator: ' + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME));
Log.Message('AM symbol: ' + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159));
Log.Message('PM symbol: ' + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359));
end;
C++Script, C#Script
function GetTimeSettings()
{
Log["Message"]("Time format: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT));
Log["Message"]("Time separator: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME));
Log["Message"]("AM symbol: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159));
Log["Message"]("PM symbol: " + aqEnvironment.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359));
}