Creating JRas resource bundles and message files
The WebSphere® Application Server message logger provides the message and msg methods so the user can log localized messages. In addition, the message logger provides the textMessage method to log messages that are not localized. Applications can use either or both, as appropriate.
Before you begin
About this task
The mechanism for providing localized messages is the resource bundle support that is provided by the IBM® Developer Kit, Java Technology Edition. If you are not familiar with resource bundles as implemented by the Developer Kit, you can get more information from various texts, or by reading the API documentation for the java.util.ResourceBundle, java.util.ListResourceBundle and java.util.PropertyResourceBundle classes, as well as the java.text.MessageFormat class.
The PropertyResourceBundle class is the preferred mechanism to use. In addition, note that the JRas extensions do not support the extended formatting options such as {1, date} or {0, number, integer} that are provided by the MessageFormat class.
You can forward messages that are written to the internal WebSphere Application Server logs to other processes for display. For example, messages that are displayed on the administrative console, which can be running in a different location than the server process, can be localized using the late binding process. Late binding means that WebSphere Application Server does not localize messages when they are logged, but defers localization to the process that displays the message.
To properly localize the message, the displaying process must have access to the resource bundle where the message text is stored. You must package the resource bundle separately from the application, and install it in a location where the viewing process can access it. If you do not want to take these steps, you can use the early binding technique to localize messages as they are logged.
- Early binding
- The application must localize the message before logging it. The application looks up the localized text in the resource bundle and formats the message. When formatting is complete, the application logs the message using the textMessage method. Use this technique to package the application resource bundles with the application.
- Late binding
- The application can choose to have the WebSphere Application Server run time localize the message in the process where it displays. Using this technique, the resource bundles are packaged in a stand-alone .jar file, separately from the application. You must then install the resource bundle .jar file on every machine in the installation from which an administrative console or log viewing program might be run. You must install the .jar file in a directory that is part of the extensions class path. In addition, if you forward logs to IBM service, you must also forward the .jar file that contains the resource bundles.
To create a resource bundle, perform the following steps.