BEA Logo BEA WebLogic Server Release 6.1

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

  |  

  WebLogic Server Doc Home   |     Internationalization Guide   |   Previous Topic   |   Next Topic   |   Contents   |   View as PDF

Localizer Class Reference for BEA WebLogic Server

 

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.

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

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".

:

The recognized key values correspond to message attributes, and are:

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

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 text returned can be further expanded via java.text.MessageFormat.format(). This is certainly the case for the message body, detail, cause and action elements, all of which are localizable. The other elements (message ID, severity and subsystem) are not localizable and do not require further processing by MessageFormat.

 


Lookup Properties

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

	/weblogic/msgcat/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 page