setLocale()

The system function SysLib.setLocale is used in PageHandlers and in programs of type VGWebTransaction. The function sets the Java™ locale, which determines these aspects of runtime behavior:
  • The human language used for labels and messages
  • The default date and time formats
You might present a list of languages on a Web page, for example, and set the Java locale based on the user's selection. The new Java locale is in use until one of the following occurs:
  • You invoke SysLib.setLocale again; or
  • The browser session ends; or
  • If the Web page was presented as a result of your issuing a converse statement from the current program of type VGWebTransaction, the user submits a form or clicks a link that does not re-invoke that program; or
  • If the Web page was presented as a result of your issuing a show statement with a returning clause, the user submits a form or clicks a link that does not re-invoke the program that the statement indicated would be invoked; or
  • A new Web page is presented otherwise.

In the cases mentioned, the next Web page reverts (by default) to the Java locale 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.

SysLib.setLocale conforms to the JDK 1.1 and 1.2 API documentation for class java.util.Locale. See ISO 639 for language codes and ISO 3166 for country codes.

  SysLib.setLocale(
    languageCode CHAR(2) in,
    countryCode CHAR(2) in
    [, variant CHAR(2) in])
languageCode
A two-character language code specified as a literal or contained in an item of type CHAR. Only language codes that are defined by ISO 639 are valid.
countryCode
A two-character country code specified as a literal or contained in an item of type CHAR. Only country codes that are defined by ISO 3166 are valid.
variant
A variant, which is a code specified as a literal or contained in an item of type CHAR. This code is not part of a Java specification but depends on the browser and other aspects of the user environment.

Related reference
EGL library SysLib

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.