![]() |
![]() |
|
Using the BEA WebLogic Server Internationalization and Localization Interfaces
This section contains information about the interfaces used for internationalization and localization.
Using the Internationalization Interfaces
Internationalization of simple text-based utilities is achieved by specifying that those utilities must use Localizers to access text data. For logging purposes, however, the generated Logger classes must be used instead of the traditional method of writing English text to a log. For example, i18ngen generates a class xyzLogger in the appropriate package for the catalog xyz.xml.
As another example, when the MyUtilLog.xml catalog is used, the class programs.utils.MyUtilLogger.class is generated. For each log message defined in the catalog, this class contains static public methods as defined by the method attribute.
Using the Localization Interfaces
TextFormatter classes are generated for each simple message catalog. These classes include static methods for accessing localized and formatted text from the catalog. They are convenience classes that handle the interface with the message body, placeholders, and MessageFormat. The formatting methods are specified via the method attribute in each message definition. For example, if a message definition included the attribute method=getErrorNumber(int err) then the resulting TextFormatter class would apprear as follows:
package my.text;
public class xyzTextFormatter {
. . .
public static String getErrorNumber(int err) {
. . .
}
}
Use of the above method would resemble the following code example:
import my.text.xyzTextFormatter
. . .
xyzTextFormatter xyzL10n = new xyzTextFormatter();
System.out.println(xyzL10n.getErrorNumber(someVal));
The output prints the message text in the current locale, with the someVal argument inserted appropriately.
Two constructors are provided. The default constructor results in the use of the default locale for the Java Virtual Machine (JVM). The second constructor allows specification of a different locale without changing the locale for the entire JVM.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|