Internationalization Guide

 Previous Next Contents Index View as PDF  

Localizer Class Reference for BEA WebLogic Server

The following sections provide reference information for Localizer classes:

Note: This information on Localizer class methods is provided as reference for advanced users. Normally, users will not need to use these interfaces directly.

 


About Localizer Classes

Localizers are classes that are used by applications and server code to localize text for output. The i18ngen utility creates Localizer classes based on the content of the message catalog.

One Localizer class is generated for each catalog file. The name of the class is the catalog name (without the .xml extension, which is stripped by the utility), followed by LogLocalizer. A Localizer class for the catalog ejb.xml is ejbLogLocalizer.

 


Localizer Methods

Localizers are extensions to the java.util.ListResourceBundle class. Four additional methods are provided to simplify the access of the localization data in the Localizer. These methods are described in Table A-1.

Table A-1 Methods for Localization Data Access

Method

Description

public Object getObject(String key, String id)

Returns localization text for the key element for message id.

public Object getObject(String key, int id)

Returns localization text for the key element for message id.

public String getString(String key, String id)

Returns localization text for the key element for message id.

public String getString(String key, int id)

Returns localization text for the key element for message id.


 

Each of the methods for accessing localization data has a key argument. The following list shows the recognized values for the key argument:

With the exception of the Localizer.SEVERITY key, the localization data returned by Localizers are String objects that return an integer object.

The following list shows the severity values that are returned:

The specific strings returned are defined in the message catalogs.

The key argument to the get*() methods identify which element of a definition to return. Acceptable values are defined in the Localizer class definition. The returned text can be further expanded through java.text.MessageFormat.format(). The message body, detail, cause, and action elements are all localizable. The other elements, message ID, severity, and subsystem are not localizable and do not require further processing by MessageFormat.

 


Localizer Lookup Class

To obtain the correct Localizer for a message, use the L10nLookup class. L10nLookup is a Property class extension that is loaded at system startup from the property file:

\weblogic\i18n\i18n.properties 

This property file is created by i18ngen. Properties in the lookup file have the following format:

nnnnnn=subsystem:Localizer class

The arguments on this line are defined as follows:

For example, message 001234 is identified as an EJB subsystem message ID from the weblogic.i18n.ejbLogLocalizer class by the following property in the lookup file:

001234=EJB:weblogic.i18n.ejbLogLocalizer

 

Back to Top Previous Next