A Localizer Class Reference for WebLogic Server

This appendix describes the Localizer classes, Localizer classes, Localizer methods, key values for Localizers, and lookup properties for Localizers.

This appendix includes the following sections:

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 described in Table A-1.

These methods are not part of the Localizer. Rather, they are part of the Localizer class. 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, use the L10nLookup class, which is a property class extension that is loaded at system startup from the property file:


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: