setLocale()

The sysLib.setLocale() system function sets the Java™ locale for the run unit.
The Java locale determines these aspects of runtime behavior:

When you call sysLib.setLocale(), EGL reinitializes strLib.defaultDateFormat and strLib.defaultTimeFormat.

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:

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

If the user submits a form or clicks a link that opens a new window, the Java locale in the original window is unaffected by the locale in the new window. However, all Java code in the run unit of the page bean shares the changes you make with sysLib.setLocale(). It does not affect the locale of other pages (or the run unit of other page beans) within the same session.

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.

Syntax

  sysLib.setLocale(
    languageCode CHAR(2) in,
    countryCode CHAR(2) in
    [, variant CHAR(2) in])
languageCode
A two-character language code that is specified as a literal or contained in a CHAR variable. Only language codes that are defined by ISO 639-2 are valid.
countryCode
A two-character country code that is specified as a literal or contained in a CHAR variable. Only country codes that are defined by ISO 3166 are valid.
variant
A variant code that is specified as a literal or contained in a CHAR variable. 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

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

sysLib.setLocale("fr", "CA", "WIN"); 

Compatibility

Table 1. Compatibility considerations for setLocale()
Platform Issue
COBOL generation The sysLib.setLocale() function is not supported.
JavaScript generation The sysLib.setLocale() function is not supported.

Feedback