A Localizer Class Reference for WebLogic Server

The Localizer class created for each catalog file inlcudes the Localizer methods, key values for Localizers, and lookup properties for Localizers.


This information on Localizer class methods is provided as reference for advanced users. Normally, you do not need to use these interfaces directly. Instead, you would typically use the generated methods in the catalogs.

About Localizer Classes

The weblogic.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 for log message catalogs and TextLocalizer for simple text catalogs. A Localizer class for the catalog ejb.xml is ejbLogLocalizer.

Localizer Methods

Localizers are PropertyResourceBundle objects. Four additional methods are provided to simplify the access of the localization data in the Localizer.These methods are not part of the Localizer. Rather, they are part of the Localizer class.

The methods are described in Table A-1. The Localizer class is used by the Logger and TextFormatter classes to extract data out of the Localizer. Each Localizer has an associated Localizer class that is obtained through L10nLookup, the Localizer lookup object.

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:

  • Localizer.SEVERITY

  • Localizer.MESSAGE_ID

  • Localizer.MESSAGE_BODY

  • Localizer.MESSAGE_DETAIL

  • Localizer.CAUSE

  • Localizer.ACTION

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:

  • weblogic.logging.severities.EMERGENCY

  • weblogic.logging.severities.ALERT

  • weblogic.logging.severities.CRITICAL

  • weblogic.logging.severities.NOTICE

  • weblogic.logging.severities.ERROR

  • weblogic.logging.severities.WARNING

  • weblogic.logging.severities.INFO

  • weblogic.logging.severities.DEBUG

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, you must use the L10nLookup class, which is a property class extension that is loaded at system startup from the property file, i18n_user.properties.This property file is created by weblogic.i18ngen and is included in the WebLogic Server installation. When you start up a user application, any i18n_user.properties files in its classpath are also loaded into L10nLookup.

Properties in the lookup (i18n_user.properties) file have the following format:

nnnnnn=subsystem:Localizer class

The arguments on this line are defined as follows:

  • nnnnnn is the message ID

  • subsystem is the related subsystem

  • Localizer class is the name of the generated Localizer class

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: