BEA WebLogic Server ™ Internationalization Guide Release 7.
Copyright Copyright © 2002 BEA Systems, Inc. All Rights Reserved. Restricted Rights Legend This software and documentation is subject to and made available only pursuant to the terms of the BEA Systems License Agreement and may be used or copied only in accordance with the terms of that agreement. It is against the law to copy the software except as specifically allowed in the agreement.
Contents About This Document Audience............................................................................................................ viii e-docs Web Site................................................................................................. viii How to Print the Document............................................................................... viii Related Information..............................................................................................ix Contact Us!......
message_catalog................................................................................ 2-11 message ............................................................................................. 2-11 messagebody ..................................................................................... 2-12 Simple Text Catalog Example .......................................................... 2-13 Elements of a Locale-Specific Catalog ....................................................
Syntax ................................................................................................. 4-5 Options................................................................................................ 4-6 CatInfo Utility ................................................................................................... 4-6 Syntax ................................................................................................. 4-6 Options...........................................................
-vi Hybrid Templates for FrameMaker 5.
About This Document This document defines internationalization and localization, and explains how to use the templates and tools provided with WebLogic Server to create or edit message catalogs that are locale-specific. The document is organized as follows: Chapter 1, “Overview of Internationalization for WebLogic Server,” summarizes the processes required for internationalization and localization.
Audience This document is written for application developers who must internationalize or localize the message catalogs included in the WebLogic Server distribution for locale-specific administration and management. It is assumed that readers are familiar with the WebLogic Server Platform and know Web technologies, object-oriented programming techniques, and the Java programming language. e-docs Web Site BEA product documentation is available on the BEA corporate Web site.
Related Information For more information in general about internationalization and localization, refer to the following sources: The Java Developer Connection™ at java.sun.com The Internationalization section of the World Wide Web Consortium (W3C) Web Site at http://www.w3.org Contact Us! Your feedback on BEA documentation is important to us. Send us e-mail at docsupport@bea.com if you have questions or comments.
Documentation Conventions The following documentation conventions are used throughout this document. Convention Usage Ctrl+Tab Keys you press simultaneously. italics Emphasis and book titles. monospace text Code samples, commands and their options, Java classes, data types, directories, and file names and their extensions. Monospace text also indicates text that you enter from the keyboard. Examples: import java.util.Enumeration; chmod u+w * config/examples/applications .java config.
Convention Usage | Separates mutually exclusive choices in a syntax line. Example: java weblogic.deploy [list|deploy|undeploy|update] password {application} {source} ... Indicates one of the following in a command line: An argument can be repeated several times in the command line. The statement omits additional optional arguments.
xii Internationalization Guide
C HAPTER 1 Overview of Internationalization for WebLogic Server The following sections provide an overview of localization and internationalization: About Internationalization and Localization Standards Understanding Localization for WebLogic Server Understanding Message Catalogs Understanding Java Interfaces for Internationalization Main Steps for Creating an Internationalized Message About Internationalization and Localization Standards BEA has adopted the World Wide Web Consortium’s
1 Overview of Internationalization for WebLogic Server (I18N) refers to the preparation of software so that it behaves properly in multiple locations. Localization (L10N) is the use of locale-specific language and constructs at run time. Internationalization of textual data in WebLogic Server is provided through message catalogs. WebLogic Server supports message catalogs for log messages as well as simple text. Log messages contain data that is written to the log file.
Understanding Message Catalogs Understanding Message Catalogs All internationalized text is defined in message catalogs, each of which defines a collection of log messages or simple text. To create an internationalized message, you externalize all message strings in a message catalog so that the strings can be easily converted to multiple locales without changing or recompiling the code. The application code supplies run-time values to the logging methods.
1 Overview of Internationalization for WebLogic Server Understanding Java Interfaces for Internationalization WebLogic Server uses the Java internationalization interfaces for providing internationalization and localization. In addition to understanding how WebLogic Server handles internationalization, users should be familiar with the Java internationalization interfaces and the following classes included in the Java Development Kit (JDK): Class Description java.util.
Main Steps for Creating an Internationalized Message 2. Run i18ngen to validate the catalog you created or edited in Step 1 and generate runtime classes. The generated classes contain a method for each message. The method is defined according to information specified in the message catalog entry. The methods include Logger or TextFormatter methods, depending on the type of catalog. For details, see “18ngen Utility” on page 4-4. 3.
1 1-6 Overview of Internationalization for WebLogic Server Internationalization Guide
C HAPTER 2 Using Message Catalogs with BEA WebLogic Server The following sections describe message catalogs and how to use them: Overview of Message Catalogs Message Catalog Hierarchy Choosing Names for Message Catalogs Using Message Arguments Message Catalog Formats Overview of Message Catalogs Message catalogs are XML files that contain a description of a collection of text messages, each indexed by a unique idenifier.
2 Using Message Catalogs with BEA WebLogic Server Message catalogs support multiple locales or languages. For a specific message catalog there is exactly one default version, known as the top-level catalog. Then there are corresponding locale-specific catalogs, one for each additional supported locale. The top-level catalog includes all the information necessary to define the message.
Choosing Names for Message Catalogs Note: This directory path may vary, depending on where you chose to install WebLogic Server. Catalogs that provide different localizations of the base catalogs are defined in msgcat subdirectories named for the locale (for example, msgcat\de for Germany). You might have a top-level catalog named mycat.xml, and a German translation of it called ..\de\mycat.xml.
2 Using Message Catalogs with BEA WebLogic Server Java allows you to group classes into a collection called a package. A package name should be consistent with the name of the subsystem in which a particular catalog resides. The log Localizer “classes” are actually ResourceBundle property files. Using Message Arguments The message body, message detail, cause, and action sections of a log message can include message arguments, as described by java.text.MessageFormat.
Message Catalog Formats An example of a method attribute for the above message is as follows: -method=“logNoFile(String name, String path)” The message expects two arguments, {0} and {1}: {0} is used in the message body. Both are used in the message detail. Neither is used in the or section. In addition, the arguments are expected to be strings, or representable as strings. Numeric data is represented as {n,number}. Dates are supported as {n,date}.
2 Using Message Catalogs with BEA WebLogic Server log_message Other log_message Catalog Elements message_catalog The following table describes the attributes that you can define for the message_catalog element. Attribute Default Required/ Optional Description i18n_package weblogic.i18n Optional Java package containing generated Logger classes for this catalog. The classes are named after the catalog file name. For example, for a catalog using mycat.
Message Catalog Formats Attribute Default Required/ Optional Description endid 499999 for WebLogic Server catalogs Optional Specifies the highest message ID used in this catalog. The syntax is one to six decimal units. 999999 for user-defined catalogs log_message The following table describes the attributes that you can define for the log_message element. Attribute Default Required/ Optional Description messageid None Required Unique identifier for this log message.
2 Using Message Catalogs with BEA WebLogic Server Attribute Default Required/ Optional Description method None Required Method signature for logging this message. Two methods are actually provided: the one specified here and a similar one with an additional Throwable argument. The syntax is the standard Java method signature, without the qualifiers, semicolon, and extensions. Argument types can be any Java primitive or class. Classes must be fully qualified if not in java.lang.
Message Catalog Formats Element Parent Element Required/ Optional Description messagebody log_message Required A string containing a short description for this message. This element may contain zero or more placeholders, {n} that are replaced by the appropriate argument when the log message is localized. messagedetail log_message Required A string containing a detailed description of the event.
2 Using Message Catalogs with BEA WebLogic Server version="1.0" baseid="600000" endid="600100" Could not open file, {0} on {1,date} after {2,number} attempts. The configuration for this application will be defaulted to factory settings. Custom configuration information resides in file, {0}, created on {1,date}, but is not readable.
Message Catalog Formats message_catalog The following table describes the attributes that you can define for the message_catalog element. Attribute Default Required/ Optional Description l10n_package weblogic.i18n Optional Java package containing generated TextFormatter classes and TextLocalizer properties for this catalog. Classes are named after the catalog file name. For example, for a catalog called mycat.xml, a properties file called l10n_package.mycatTextLocalizer properties is generated.
2 Using Message Catalogs with BEA WebLogic Server Attribute Default Required/ Optional Description method None Optional Method signature for formatting this message. The syntax is a standard Java method signature, less return type, qualifiers, semicolon, and extensions. The return type is always String. Argument types can be any Java primitive or class. Classes must be fully qualified if not in java.lang. Classes must also conform to java.text.MessageFormat conventions.
Message Catalog Formats Element Parent Element Required/ Optional messagebody message Required Description The text associated with the message. This element may contain zero or more placeholders {n} that will be replaced by the appropriate arguments when the log message is localized. Simple Text Catalog Example The following example shows a simple text catalog, MyUtilLabels.xml, with one text definition. Listing 2-3 Example of a Simple Text Catalog
2 Using Message Catalogs with BEA WebLogic Server Elements of a Locale-Specific Catalog The locale-specific catalogs are subsets of top-level catalogs. They are maintained in subdirectories named for the locales they represent. The elements and attributes described in the following sections are valid for locale-specific catalogs. locale_message_catalog The following table describes the attributes that you can define for the locale_message_catalog element.
Message Catalog Formats Locale Message Catalog Syntax The following example shows a French translation of a message that is available in ...\msgcat\fr\MyUtilLabels.xml. The translated message appears as shown in Listing 2-4. Listing 2-4 Example of a Message Translated to French PAGE 342 2-16 Using Message Catalogs with BEA WebLogic Server Internationalization Guide
C HAPTER 3 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.
3 Using the BEA WebLogic Server Message 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.
Starting the Message Editor 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.
3 Using the BEA WebLogic Server Message Editor 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: 3-4 Browsing to an Existing Catalog Creating a New Catalog Internationalization Guide
Working with Catalogs 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.
3 Using the BEA WebLogic Server Message Editor 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.
Working with Catalogs 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.
3 Using the BEA WebLogic Server Message Editor 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.
Adding Messages to Catalogs 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.
3 Using the BEA WebLogic Server Message Editor 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.
Adding Messages to Catalogs 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.
3 Using the BEA WebLogic Server Message Editor 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.
Finding Messages 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.
3 Using the BEA WebLogic Server Message Editor 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.
Using the Message Viewer 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.
3 Using the BEA WebLogic Server Message Editor 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.
C HAPTER 4 Using the BEA WebLogic Server Internationalization Utilities The following sections contain information about the WebLogic Server utilities used for internationalization and localization: About the WebLogic Server Internationalization Utilities About the WebLogic Server Internationalization and Localization Interfaces 18ngen Utility l10ngen Utility CatInfo Utility About the WebLogic Server Internationalization Utilities WebLogic Server provides three internationalization uti
4 Using the BEA WebLogic Server Internationalization Utilities 18ngen Utility—Message catalog parser. Use this utility to generate classes used for localizing text in log messages. l10ngen Utility—Locale-specific message catalog parser. Use this utility to process locale-specific catalogs. CatInfo Utility—Utility that lists installed log messages. Use this utility to generate a list of installed log messages.
About the WebLogic Server Internationalization and Localization Interfaces As another example, when the MyUtilLog.xml catalog is used, the class programs.utils.MyUtilLogger.class is generated. For each log message defined in the catalog, this class contains static public methods as defined by the method attribute. TextFormatter classes are generated for each simple message catalog. These classes include static methods for accessing localized and formatted text from the catalog.
4 Using the BEA WebLogic Server Internationalization Utilities The output prints the message text in the current locale, with the someVal argument inserted appropriately. 18ngen Utility The i18ngen utility parses message catalogs (XML files) to produce Logger and TextFormatter classes used for localizing the text in log messages. The top-level message catalogs are compiled into Java classes and properties files. The i18ngen utility also creates or updates the i18n_user.properties file.
l10ngen Utility -i18n Creates the internationalizer source (for example, *Logger.java) that supports the logging of internationalized messages. -l10n Creates the localizer source (property resource bundles) that provides access to each message defined in each message catalog. These properties are used by localization utilities to localize messages. -compile Compiles generated Java files using the current CLASSPATH. The resulting classes are placed in the directory identified by the -d option.
4 Using the BEA WebLogic Server Internationalization Utilities Note: Utilities can be run from any directory, but if files are listed on the command line, then their path is relative to the current directory. Options Option Definition -d targetdirectory Directory in which to place properties. Default is the current directory. -language code Language code. Default is all. -country code Country code. Default is all. -variant code Variant code. Default is all.
CatInfo Utility Options Note: All options may be abbreviated to a single character. Option Definition -id nnnnnn where nnnnnn represents the message ID. The -id option is used to specify a particular message. -subsystem identifier The subsystem identifier. The -subsystem option prints only those messages that match the specified subsystem. -detail Requests a detailed listing. The -detail option also requests version, severity, subsystem, message detail, cause, and action information.
4 4-8 Using the BEA WebLogic Server Internationalization Utilities Internationalization Guide
A PPENDIX A Localizer Class Reference for BEA WebLogic Server The following sections provide reference information for Localizer classes: About Localizer Classes Localizer Methods Localizer Lookup Class Note: This information on Localizer class methods is provided as reference for advanced users. Normally, users will not need to use these interfaces directly. About Localizer Classes Localizers are classes that are used by applications and server code to localize text for output.
A Localizer Class Reference for BEA WebLogic Server Localizer Methods 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 described in Table A-1. 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.
Localizer Lookup Class 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.ERROR weblogic.logging.severities.WARNING weblogic.logging.severities.NOTICE weblogic.logging.severities.INFO weblogic.logging.severities.DEBUG The specific strings returned are defined in the message catalogs.
A Localizer Class Reference for BEA WebLogic Server 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: 001234=EJB:weblogic.i18n.
A PPENDIX B Logger Class Reference for BEA WebLogic Server The following sections provide reference information for Logger classes: About Logger Classes Example of a Generated Logger Class Note: This information on Logger classes is provided as reference of methods for normal usage. Normally, users will not need to use these interfaces directly. About Logger Classes The classes generated by i18ngen are known as Loggers. Logger classes provide the interface to WebLogic Server error logging.
B Logger Class Reference for BEA WebLogic Server Example of a Generated Logger Class Listing B-1 show an example of a catalog with a single message definition: Listing B-1 Example of Message Catalog PAGE 65Example of a Generated Logger Class stacktrace="true" > This message is followed by a trace This message is not followed by a trace, but we can insert its text : {0} PAGE 66B Logger Class Reference for BEA WebLogic Server Listing B-2 Example of Generated Logger Class package examples.i18n.logging; import weblogic.logging.MessageLogger; import weblogic.logging.Loggable; import java.util.MissingResourceException; /** * Copyright (c) 2001 by BEA Systems, Inc. All Rights Reserved. * @exclude */ public class I18nLogLogger { /** * Starting I18nLog example... * @exclude * * messageid: 600000 * severity: info */ public static String logEntry() { Object [] args = { }; MessageLogger.
Example of a Generated Logger Class public static Loggable testArgsLoggable(String arg0, int arg1) throws MissingResourceException { Object[] args = { arg0, new Integer(arg1) }; return new Loggable("600001", args); } /** * This message is followed by a trace * @exclude * * messageid: 600002 * severity: error */ public static String logTrace(Throwable arg0) { Object [] args = { arg0 }; MessageLogger.log( "600002", args, "examples.i18n.logging.
B Logger Class Reference for BEA WebLogic Server * messageid: 600004 * severity: info */ public static String getId() { Object [] args = { }; MessageLogger.log( "600004", args, "examples.i18n.logging.
Example of a Generated Logger Class import java.util.Locale; import weblogic.i18n.Localizer; import weblogic.i18ntools.L10nLookup; import weblogic.logging.Loggable; /** * @author Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved. */ /** * This example shows how to use the internationalized (I18n) logging interfaces. *
* usage: java examples.i18n.logging.I18nLog *
* Build procedure: run bld.sh (UNIX) or bld.cmd (NT). These scripts * process the I18nLog.
B Logger Class Reference for BEA WebLogic Server */ Throwable t = new Throwable("Test with stack trace"); I18nLogLogger.logTrace(t); /** * Messages can optionally be defined to not log a stack trace. */ I18nLogLogger.logNoTrace(t); /** * The logger methods return the messageid for applications * that want to do more than just log these messages. */ String messageId = I18nLogLogger.getId(); I18nLogLogger.showId(messageId); /** * the message id can be used to obtain the different attributes * of a message.
Example of a Generated Logger Class System.out.println(fmt.i18nPackage(messageId,lcl.getI18nPackage())); System.out.println(fmt.subsystem(messageId,lcl.getSubSystem())); System.out.println(fmt.severity(messageId,lcl.getSeverity(messageId))); System.out.println(fmt.body(messageId,lcl.getBody(messageId))); System.out.println(fmt.stack(messageId,lcl.getStackTrace(messageId))); /** * Now for the detailed information. */ System.out.println(fmt.detail(messageId,lclDetail.getDetail(messageId))); System.out.
B B-10 Logger Class Reference for BEA WebLogic Server Internationalization Guide
A PPENDIX C Loggable Object Reference for BEA WebLogic Server The following sections provide reference information for Loggable objects: About Loggable Objects How Loggable Objects Are Used About Loggable Objects By default, all log message catalogs create Logger classes with methods that are used to log the messages to the WebLogic Server log. The Logger classes can optionally include methods that return a Loggable object instead of logging the message.
C Loggable Object Reference for BEA WebLogic Server How Loggable Objects Are Used To create a Logger that provides methods to return Loggable objects, you need to set the loggables attribute in the message catalog. For example, consider the test.xml catalog shown in Listing C-1. Listing C-1 test.xml Message Catalog PAGE 75
How Loggable Objects Are Used logIOErrorLoggable (Throwable)—returns a Loggable object The Loggable class can be used as shown in Listing C-2. Listing C-2 Example of Use of Loggable Class package test; import weblogic.logging.Loggable; import weblogic.i18n.testLogger; ... try { // some IO } catch (IOException ioe) { Loggable l = testLogger.logIOErrorLoggable(ioe); l.log(); // log the error throw new Exception(l.
C C-4 Loggable Object Reference for BEA WebLogic Server Internationalization Guide
A PPENDIX D TextFormatter Class Reference for BEA WebLogic Server The following sections provide reference information for TextFormatter classes: About TextFormatter Classes Example of an Application Using a TextFormatter Class Note: This information on TextFormatter classes is provided as reference of methods for normal usage. Normally, users will not need to use these interfaces directly. About TextFormatter Classes TextFormatter classes are generated by i18ngen from simple message catalogs.
D TextFormatter Class Reference for BEA WebLogic Server Example of an Application Using a TextFormatter Class Listing 4-3 shows an example of a simple message catalog for the HellowWorld application. Listing 4-3 Example of a Simple Message Catalog PAGE 79Example of an Application Using a TextFormatter Class This is hello number {0,number}.
D TextFormatter Class Reference for BEA WebLogic Server datelastchanged="967578755587" method="subSystem(String sub)" > Catalog subsystem: {0} Listing 4-4 shows an example of an application using the HelloWorld catalog. Listing 4-4 Example of an Application Using the HelloWorld Catalog package examples.i18n.simple; import java.util.Locale; import java.text.MessageFormat; import weblogic.i18n.Localizer; import weblogic.i18ntools.
Example of an Application Using a TextFormatter Class * using the catalog editing utility, weblogic.i18ntools.gui.MessageEditor. *
*
* English(base language) ../msgcat/Helloworld.xml * French ../msgcat/fr/FR/HelloWorld.xml *
* * To build this example run the bld.sh(UNIX) or bld.cmd (NT) scripts from * the examples/i18n/simple directory. CLIENT_CLASSES must be set up and * needs to be in the classpath when running the example.
D TextFormatter Class Reference for BEA WebLogic Server */ HelloWorldTextFormatter fmt = new HelloWorldTextFormatter(lcl); fmt.setExtendedFormat(true); /* * print the text in the current locale */ System.out.println(fmt.helloWorld()); /* * Alternatively, text can be accessed and formatted manually. In this * case you must obtain the Localizer class for the catalog. The Localizer * class is formed from the l10n_package attribute in the catalog, the * catalog name, and the string "TextLocalizer".
Example of an Application Using a TextFormatter Class Listing 4-5 Example of Generated TextFormatter Class for the HelloWorld Catalog PAGE 84D TextFormatter Class Reference for BEA WebLogic Server Catalog version: {0} I18n Package: {0}
Example of an Application Using a TextFormatter Class Internationalization Guide D-9
D D-10 TextFormatter Class Reference for BEA WebLogic Server Internationalization Guide
Index A E argument key A-2 message 2-4 elements locale-specific catalog 2-14 log message catalog 2-5 simple text message catalog 2-10 C catalog browsing for 3-5 context 3-2 creating 3-7 entering a new log message 3-9 entering a simple text message 3-11 locale-specific 1-5, 2-3, 2-5 message 1-4 naming 2-3 top-level 2-2, 2-5 CatInfo 4-6 character code 3-2 class Localizer A-1 Loggable C-3 Logger 4-2, B-1, C-2 TextFormatter 4-2, D-1 context catalog 3-2 customer support contact information ix D documentatio
definition of 1-2 log messages 1-2 simple text 1-2 Localizers 4-2, A-1 log message catalog elements 2-5 example 2-9 syntax 2-15 Loggable object C-1 Logger B-1 naming conventions classes 2-3 message catalogs 2-3 O object Loggable C-1 P M message arguments 2-4 create an internationalized 1-3 editing 3-16 finding 3-12 finding a log message 3-12 selecting in Message Viewer 3-15 viewing all in catalog 3-14 viewing all in several catalogs 3-15 message catalog formats 2-5 hierarchy 2-2 naming 2-3 message edito