BEA WebLogic Server User Manual

Page 53

Advertising
background image

About the WebLogic Server Internationalization and Localization Interfaces

Internationalization Guide

4-3

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.

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

. You specify the formatting methods through the

method attribute in each message definition. For example, if the definition of a
message in a catalog includes the attribute,

method=getErrorNumber(int err)

, the

TextFormatter

class shown in

Listing 4-1

is generated.

Listing 4-1 Example of a TextFormatter Class

package my.text;
public class xyzTextFormatter
{
. . .
public String getErrorNumber(int err)
{
. . .
}
}

Listing 4-2

shows an example of how the

getErrorNumber

method could be used in

code.

Listing 4-2 Example of getErrorNumber Method

import my.text.xyzTextFormatter
. . .

xyzTextFormatter xyzL10n = new xyzTextFormatter();
System.out.println(xyzL10n.getErrorNumber(someVal));

Advertising