$nlslocale
Set or return the current locale (language and country), or locale setting.
$nlslocale =
"classic"
| "system"
| ln_CY
result =
$nlslocale
Parameters
Parameter | Data Type | Description |
---|---|---|
classic
|
String | No locale-based sorting or formatting is performed. This is the default. |
system
|
String | Sorting and formatting behavior is based on the locale defined for the local (client) system; Windows only |
ln_CY | String | Locale identifier, in which
ln specifies the two-letter language code and CY the two-letter
country code as defined by ISO 639; for example, fr_CA for French (Canada) |
Return Values
Returns the current locale or setting.
Use
Allowed in all component types.
Description
When setting the $nlslocale, you can specify the value as a string, field (or indirect reference to a field), variable, or function that evaluates to a string.
The value of $nlslocale
overrides the value of the $NLS_LOCALE assignment setting. If the NLS locale is
set to system
or a specific locale, locale-based processing rules are applied,
unless they are overridden by one of these other assignment settings, or in ProcScript. If it is
set to classic
, Uniface does not apply locale-based processing unless the locale is
set in ProcScript using $nlslocale.
The default value of
the$NLS_CASE, $NLS_FORMAT, and
$NLS_SORT_ORDER assignment settings is nlsformat
. This means that
they use the value set by $NLS_LOCALE to control their specific area of
functionality. Thus, setting $nlslocale affects the default way in which data is
displayed, sorted, and transformed with case conversion. For more information, see Language and Locale.
You can use $nlslocalelist to get the system locale or a list of locales.
Note: The NLS locale is not used for locale-based processing in the client side of a dynamic server page. To set the locale for the DSP client, you can use $webinfo("locale").
Effect of Locale on Displayed Date
In the following example, when the user selects a locale in the LOCALES field, the valueChanged trigger assigns this value to the $nlslocale and updates the value of the CURRENTDATE field.
trigger valueChanged ; of LOCALES $nlslocale = LOCALES CURRENTDATE = $datim end; valueChanged
With the display format (Field
Layout) of CURRENTDATE set to DIS($NLS(FULL, DATE))
, the following
table shows how the date is displayed for some example locales:
Locale Code | Locale | Displayed Data |
---|---|---|
en_US | English (United States) | Wednesday, December 2, 2019 |
en_GB | English (United Kingdom) | Wednesday, 2 December 2019 |
fr_CA | French (Canada) | mercredi 2 décembre 2019 |
nl_NL | Dutch (Netherlands) | woensdag 2 december 2019 |
ja_JP | Japanese (Japan) | 2019年12月2日水曜日 |
bg_BU | Bulgarian (Bulgaria) | 02 декември 2019, сряда |
Setting Locale with Local Browser Setting
When a request is sent to a Uniface Web application from the client browser, the locale of the browser is included in the HTTP headers. This can be useful, for example, if you want to return information in the local language or currency. Use the following ProcScript construction to extract the browser locale from the request header and use it to set $nlslocale:
$nlslocale = $item("accept-language", $webinfo("httpRequestHeaders"))
Version | Change |
---|---|
9.4.01 | Introduced |