SysLib.setLocale function

SysLib.setLocale sets the Java™ locale for the run unit.

Package

eglx.lang

Syntax
static function setLocale(languageCode string in);

static function setLocale(languageCode string in, countryCode string in);

static function setLocale(languageCode string in, countryCode string in, variant string in);
languageCode
A two-character language code. Only language codes that are defined by ISO 639-2 are valid.
countryCode
A two-character country code. Only country codes that are defined by ISO 3166 are valid.
variant
A variant code. The code is usually an uppercase string that is used in conjunction with languageCode and countryCode to create the locale identifier, as in the example.
Example use

The following example changes the locale to Canadian French for Windows™.

sysLib.setLocale("fr", "CA", "WIN"); 
Comments
The Java locale determines these aspects of runtime behavior:
  • The human language used for labels and messages
  • The default date and time formats
For example, you might present a list of languages and set the Java locale based on the language the user selects. The new Java locale is in use until one of the following occurs:
  • You call sysLib.setLocale() again.
  • The browser session ends.
  • A new web page is presented for any other reason.

In the cases mentioned, the next web page reverts by default to the Java locale that is specified in the browser.

Language codes follow the ISO 639-2 standard, and country codes follow the ISO 3166 standard. For more information, see the related reference links at the end of this topic and the documentation for the java.util.Locale class.


Compatibility

Table 1. Compatibility
Target Issue
Java No issues.
JavaScript SysLib.setLocale() is not supported.