setLocale()
The sysLib.setLocale() system function sets the Java™ locale for the run unit.
- The human language used for labels and messages
- The default date and time formats
When you call sysLib.setLocale(), EGL reinitializes strLib.defaultDateFormat and strLib.defaultTimeFormat.
- 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.
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
| Platform | Issue |
|---|---|
| COBOL generation | The sysLib.setLocale() function is not supported |
| JavaScript™ generation | The sysLib.setLocale() function is not supported |