bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Internationalization Guide

Using the BEA WebLogic Server Message Editor

The following sections describe how to use the Message Editor:

- About the Message Editor

- Starting the Message Editor

- Working with Catalogs

- Adding Messages to Catalogs

- Finding Messages

- Using the Message Viewer

- Editing an Existing Message

About the Message Editor

The Message Editor is a graphical interface tool that allows you to create, read, and write XML message catalogs. The Message Editor is installed when you install WebLogic Server. Optionally, you can also edit the XML catalogs directly in a text editor.

Note: The Message Editor does not support the editing of localized catalogs.

The Message Editor allows you to perform the following tasks:

- Create XML message catalogs

- Create and edit messages

- View all the messages in one catalog

- View all the messages in several catalogs simultaneously

- Search for messages

- Validate the XML in catalog entries

The catalog currently being created or used in the Message Editor is the context catalog.

The catalog parsers (i18ngen or l10ngen) recognize character code references for special characters and convert them to the intended character, as shown in Table 3-1. The Message Editor recognizes the special characters and writes them back using the character code references. The parsers recognize no other character references.

####

Table 3-1 Special Character Reference

Character Code | Special Character
--- | ---
&amp; | @
&lt; | <
&gt; | >
&apos; | `
&quot; | "

Starting the Message Editor

Before you start the Message Editor, you should have installed and configured your WebLogic Server system and set your environment variables (setExamplesEnv.cmd). Make sure that your classpath is set correctly.

Sample message catalog files are located in your BEA_HOME\samples\wlserver7.0\samples\examples\i18n\msgcat directory.

Note: This directory path may vary, depending on where you chose to install WebLogic Server.

To start the Message Editor, type:

>     java weblogic.MsgEditor

>     or

>     java weblogic.i18ntools.gui.MessageEditor

The main WebLogic Message Editor window for Log Messages displays as shown in Figure 3-1.

Figure 3-1 WebLogic Message Editor for Log Messages

Working with Catalogs

The following sections describe how to use the Message Editor to manage catalogs:

- Browsing to an Existing Catalog

- Creating a New Catalog

Browsing to an Existing Catalog

To find an existing catalog from the main WebLogic Message Editor window, enter the full pathname in the Message Catalog field, or click Browse and navigate to the existing catalog from the Open dialog.

Figure 3-2 Open

The sample catalogs included with your WebLogic Server installation are in the BEA_HOME\samples\wlserver7.0\samples\examples\i18n\msgcat directory.

Note: This directory path may vary, depending on where you chose to install WebLogic Server.

Your user-defined catalogs may be located in any directory you designate.

Once the catalog has been located, the Packages, Subsystem, Version, Base ID, and End ID (if any) for that catalog are displayed, and that catalog is the context catalog in which all other actions are performed. You are now ready to enter new messages into that catalog, to edit existing messages, to search for a message, or to view all messages in the catalog.

If a log message catalog is selected in the Message catalog field, the WebLogic Message Editor window for Log Messages displays as shown in Figure 3-3.

Figure 3-3 WebLogic Message Editor for Log Messages

If a simple messages catalog is selected in the Message catalog field, the WebLogic Message Editor window for Simple Messages displays as shown in Figure 3-4.

Figure 3-4 WebLogic Message Editor for Simple Messages

Creating a New Catalog

To create a new catalog, complete the following procedure:

1. Choose the File menu from the main menu bar of the WebLogic Message Editor window.

2. Choose New Catalog.

   The "Create new catalog" dialog displays as shown in Figure 3-5.

   Figure 3-5 Create New Catalog

3. In the Message Catalog field, enter the full pathname and the name of the new catalog, which must include the xml extension. Or, click Browse and navigate to the WebLogic catalog directory, msgcat.

4. Use the drop-down Catalog type list to indicate whether your catalog is to be a Log message catalog or a Simple text message catalog.

   If you select a log message catalog, the Base ID and End ID fields are displayed. These fields indicate the range of ID numbers for messages in the catalog. If you select a simple text message catalog, these fields disappear.

5. Enter the name of the package where you want to place generated Logger classes in the I18n package field. The default is weblogic.i18n. If you want to place your logger classes in another package with your application, specify the package name here.

6. Enter the name of the package where you want to place the catalog data in the L10n package field. The default is weblogic.i18n. If you want to place your catalog data in another package with your application, specify the package name here.

7. Enter a name in the Subsystem field to indicate which part of the system logged the message. This name is logged with the message. For applications, the application name is normally entered in the Subsystem field.

8. Click Create Catalog.

   The "Create new catalog" dialog closes, and the catalog you just created is displayed as the context catalog in the main Message Editor window.

Adding Messages to Catalogs

The following sections describe how to use the Message Editor to add messages to catalogs:

- Entering a New Log Message

- Entering a New Simple Text Message

Entering a New Log Message

To enter a new message into a log catalog, complete the following procedure:

1. From the WebLogic Message Editor main dialog as shown in Figure 3-6, enter the full pathname in the Message Catalog field or click Browse and navigate to the existing catalog.

   Figure 3-6 Log Messages

2. Enter a unique alphanumeric Message ID or click Get next ID to get the next unique numerical ID in the context catalog.

3. Enter the appropriate Method for your log message, including parentheses and any arguments. For example:

   >     logNoAuthorization(String arg0, java.util.Date arg1,
   >        int arg2) logNote()

4. Choose a Severity from the list of possible levels.

5. Enter text for the Message body, Message detail, Possible cause, and Action. Parameters are denoted by {n}. For example:

   >     User {0} tried to access this on {1} but has no authority to do so. {2} lashes with a keyboard with coke spilled on it.

6. Toggle the Display stacktrace option on or off by clicking the checkmark box. Use this option to print a stacktrace along with the message when a Logger method takes an exception as one of its arguments.

7. Click Add.

   The message is added and the entire catalog is immediately written to disk.

Entering a New Simple Text Message

To enter a simple text message into a simple messages catalog, complete the following procedure:

1. From the WebLogic Message Editor main dialog, enter the full pathname in the Message Catalog field or click Browse and navigate to the existing catalog.

   The WebLogic Message Editor for Simple Messages dialog displays as shown in Figure 3-7.

   Figure 3-7 Simple Messages

2. Enter a unique alphanumeric Message ID.

3. Enter a Comment if required.

4. Enter the appropriate Method for your simple message, including parentheses and any arguments.

5. Enter the Message body text.

6. Click Add.

   The message is added and the entire catalog is immediately written to disk.

Finding Messages

The following sections describe how to use the Message Editor to find messages:

- Finding a Log Message

- Finding a Simple Text Message

Finding a Log Message

To find a log message, complete the following procedure:

1. Make sure that the context catalog is a log message catalog and the WebLogic Message Editor Log Messages main window is displayed as shown in Figure 3-3.

2. Choose Edit from the main menu bar.

3. Choose Search to display the "Search for Log Message" dialog as shown in Figure 3-8.

   Figure 3-8 Search for Log Message

4. Enter the Message ID and the Method name.

5. Enter as much information as you need in the Message text search field to find the correct message. The search for text does a partial match in any of the text fields.

6. Click Find first or Find next.

   The fields are strung together to find the message. If a matching message is found, it displays in the main Message Editor window as shown in Figure 3-1.

Finding a Simple Text Message

To find a simple text message, complete the following procedure:

1. Make sure that the context catalog is a simple text message catalog and the WebLogic Message Editor Simple Messages main window is displayed as shown in Figure 3-4.

2. Choose Edit from the main menu bar.

3. Choose Search to display the "Search for Simple Message" dialog as shown in Figure 3-9.

   Figure 3-9 Search for Simple Message

4. Enter the Message ID.

5. Enter as much information as you need in the Message text search field to find the correct message. The search for text does a partial match in any of the text fields.

6. Click Find first or Find next.

   The fields are strung together to find the message. If a matching message is found, it displays in the main Message Editor window as shown in Figure 3-4.

Using the Message Viewer

The WebLogic Message Editor contains a Message Viewer that allows you to view all messages in a catalog, view all messages in multiple catalogs, and choose any message to edit.

The following sections describe how to use the Message Viewer to view and choose messages to edit:

- Viewing All Messages in a Catalog

- Viewing All Messages in Several Catalogs

- Choosing a Message to Edit from the Message Viewer

Viewing All Messages in a Catalog

To view all the messages in a catalog:

1. Open the WebLogic Message Editor. The main WebLogic Message Editor window displays with the catalog for the last message viewed as the current context catalog.

2. Choose View from the menu bar. All the messages for the current context catalog display in a table in the Message Viewer window, as shown in Figure 3-10. The Message Viewer displays in a separate window from the Message Editor and the Message Editor remains open.

   Figure 3-10 Message Viewer

Viewing All Messages in Several Catalogs

If you view the messages from the current context catalog, and then change the context by clicking Browse on the WebLogic Message Editor main window to navigate to a new catalog, the old view of the old catalog remains on the screen while you view the new catalog in a second Message Viewer window. Repeating this step allows you to view messages for as many catalogs as you require (or can reasonably fit on your screen). Each catalog displays in a separate Message Viewer window. Refer to Browsing to an Existing Catalog for information about Browsing to a new catalog.

Choosing a Message to Edit from the Message Viewer

After you use the Message Viewer to view a list of messages, you can click on any message displayed in any row of the Message Viewer. The catalog for the selected message becomes the context catalog and the message displays in the Message Editor main window.

Figure 3-11 Message Viewer and Message Editor for Message 600002

Editing an Existing Message

To edit an existing message, complete the following procedure:

1. Find the message you want to edit, either by using the Search dialog as described in Finding a Log Message and Finding a Simple Text Message, or by clicking on a row in the message viewer as described in Choosing a Message to Edit from the Message Viewer.

2. Edit the fields you wish to change in the main Message Editor window.

3. Click Update.

   The message is updated and the entire catalog is immediately written to disk.