BEA  WebLogic Server Manual
BEA  WebLogic Server Manual

BEA WebLogic Server Manual

Internationalization guide
Hide thumbs Also See for BEA WebLogic Server:
Table of Contents

Advertisement

Quick Links

WebLogic
BEA
Server
Internationalization Guide
Release 7.0
Document Revised: August 20, 2002

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BEA WebLogic Server and is the answer not in the manual?

Questions and answers

Summary of Contents for BEA BEA WebLogic Server

  • Page 1 WebLogic Server ™ Internationalization Guide Release 7.0 Document Revised: August 20, 2002...
  • Page 2: Software Version

    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.
  • Page 3: Table Of Contents

    Understanding Message Catalogs ... 1-3 Understanding Java Interfaces for Internationalization ... 1-4 Main Steps for Creating an Internationalized Message ... 1-4 2. Using Message Catalogs with BEA WebLogic Server Overview of Message Catalogs... 2-1 Message Catalog Hierarchy ... 2-2 Choosing Names for Message Catalogs... 2-3 Using Message Arguments...
  • Page 4 ... 2-14 log_message ... 2-14 Other locale_message_catalog Elements ... 2-14 Locale Message Catalog Syntax ... 2-15 3. Using the BEA WebLogic Server Message Editor About the Message Editor ... 3-1 Starting the Message Editor... 3-3 Working with Catalogs... 3-4 Browsing to an Existing Catalog...
  • Page 5 Syntax ... 4-5 Options... 4-6 CatInfo Utility ... 4-6 Syntax ... 4-6 Options... 4-7 A. Localizer Class Reference for BEA WebLogic Server About Localizer Classes...A-1 Localizer Methods...A-2 Localizer Lookup Class...A-3 B. Logger Class Reference for BEA WebLogic Server About Logger Classes ...B-1 Example of a Generated Logger Class...B-2...
  • Page 6 Hybrid Templates for FrameMaker 5.5...
  • Page 7: About This Document

    Chapter 1, “Overview of Internationalization for WebLogic Server,” the processes required for internationalization and localization. Chapter 2, “Using Message Catalogs with BEA WebLogic Server,” message catalog types, message definitions, elements, and arguments. Chapter 3, “Using the BEA WebLogic Server Message Editor,”...
  • Page 8: Audience

    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. From the BEA Home page, click on Product Documentation. How to Print the Document You can print a copy of this document from a Web browser, one main topic at a time, by using the File Print option on your Web browser.
  • Page 9: Related Information

    If you have any questions about this version of BEA WebLogic Server, or if you have problems installing and running BEA WebLogic Server, contact BEA Customer Support through BEA WebSupport at http://www.bea.com.
  • Page 10: Documentation Conventions

    Documentation Conventions The following documentation conventions are used throughout this document. Convention Ctrl+Tab italics monospace text monospace italic text UPPERCASE TEXT Internationalization Guide Usage Keys you press simultaneously. Emphasis and book titles. Code samples, commands and their options, Java classes, data types, directories, and file names and their extensions.
  • Page 11 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. You can enter additional parameters, values, or other information Internationalization Guide...
  • Page 12 Internationalization Guide...
  • Page 13: Overview Of Internationalization For Weblogic Server

    About Internationalization and Localization Standards BEA has adopted the World Wide Web Consortium’s (W3C) recommendations for standard formats and protocols that are usable worldwide in all languages and in all writing systems. These standards are part of the Java internationalization Application Program Interfaces (APIs) that are used by WebLogic Server.
  • Page 14: Understanding Localization For Weblogic Server

    Simple text—Simple text is any text other than log messages and exceptions that the server must display, such as the output from a utility. Examples of simple text include usage messages, graphical user interface (GUI) labels, and error messages.
  • Page 15: Understanding Message Catalogs

    Message IDs in simple text catalogs are unique within each simple text catalog. Refer to “Using Message Catalogs with BEA WebLogic Server” on page 2-1 detailed information about message catalogs. Understanding Message Catalogs...
  • Page 16: Understanding Java Interfaces For Internationalization

    In addition to message text, include information about the type and placement of any run-time values that the message contains. Internationalization Guide Description Represents a specific geographical, political, or cultural region. Provides containers for locale-specific objects. Produces concatenated messages in a language-neutral way. “Using the BEA WebLogic Server...
  • Page 17: Main Steps For Creating An Internationalized Message

    These steps are described in detail in the following topics. For more detailed information, including an overview of the logging subsystem and a description of log message parts, see “Using Log Messages to Manage WebLogic Servers” WebLogic Server Administration Guide. methods, depending on the type of catalog. methods you Logger...
  • Page 18 Overview of Internationalization for WebLogic Server Internationalization Guide...
  • Page 19: Using Message Catalogs With Bea Weblogic Server

    HAPTER 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.
  • Page 20: Message Catalog Hierarchy

    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.
  • Page 21: Choosing Names For Message Catalogs

    (for example, might have a top-level catalog named called ..\de\mycat.xml not required for any catalogs except the installed WebLogic Server catalogs. Locale designations (for example, java.util.Locale variant. Language is the most common locale designation. Language can be extended with a country code.
  • Page 22: Using Message Arguments

    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...
  • Page 23: Message Catalog Formats

    An example of a -method=“logNoFile(String name, String path)” The message expects two arguments, is used in the message body. Both are used in the message detail. Neither is used in the In addition, the arguments are expected to be strings, or representable as strings. Numeric data is represented as must assign a severity level for log messages.
  • Page 24: Message_Catalog

    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 Attribute Default i18n_package weblogic.i18n l10n_package weblogic.i18n None subsystem None version 000000 for baseid WebLogic Server...
  • Page 25: Log_Message

    Attribute Default 499999 for endid WebLogic Server catalogs 999999 for user-defined catalogs log_message The following table describes the attributes that you can define for the element. Attribute Default None messageid None datelastchanged None severity stacktrace true Message Catalog Formats Required/...
  • Page 26: Other Log_Message Catalog Elements

    Using Message Catalogs with BEA WebLogic Server Attribute Default None method loggables False Other log_message Catalog Elements The following table describes the child elements of the log_message element. Internationalization Guide Required/ Description Optional Required Method signature for logging this message. Two...
  • Page 27: Log Message Catalog Example

    Log Message Catalog Example The following example shows a log message catalog, message. Listing 2-2 Example of a Log Message Catalog <?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" " http://www.bea.com/servers/wls700/dtd/ msgcat.dtd"> <message_catalog l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" Message Catalog Formats Required/ Description...
  • Page 28: Elements Of A Simple Text Message Catalog

    Using Message Catalogs with BEA WebLogic Server version="1.0" baseid="600000" endid="600100" <log_message messageid="600001" severity="warning" method="logNoAuthorization(String arg0, java.util.Date arg1, int arg2)" <messagebody> Could not open file, {0} on {1,date} after {2,number} attempts. </messagebody> <messagedetail> The configuration for this application will be defaulted to factory settings.
  • Page 29: Message_Catalog

    message_catalog The following table describes the attributes that you can define for the message_catalog Attribute Default l10n_package weblogic.i18n None subsystem None version message The following table describes the attributes that you can define for the element. Attribute Default None messageid None datelastchanged element.
  • Page 30: Messagebody

    Using Message Catalogs with BEA WebLogic Server Attribute Default None method messagebody The following table describes the child element of the message element. 2-12 Internationalization Guide Required/ Description Optional Optional Method signature for formatting this message. The syntax is a standard Java method signature, less return type, qualifiers, semicolon, and extensions.
  • Page 31: Simple Text Catalog Example

    Simple Text Catalog Example The following example shows a simple text catalog, text definition. Listing 2-3 Example of a Simple Text Catalog <?xml version="1.0"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" " http://www.bea.com/servers/wls700/dtd/ msgcat.dtd"> <message_catalog> l10n_package="programs.utils" i18n_package="programs.utils" subsystem="MYUTIL" version="1.0" <message> messageid="FileMenuTitle"...
  • Page 32: Elements Of A Locale-Specific Catalog

    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.
  • Page 33: Locale Message Catalog Syntax

    Unicode character-strings that optimizes the encoding ASCII characters. Message catalogs always use UTF-8 encoding. The utility that is downloaded with WebLogic Server is a tool that can be used to generate valid UTF-8 characters. Message Catalog Formats Listing 2-4.
  • Page 34 Using Message Catalogs with BEA WebLogic Server 2-16 Internationalization Guide...
  • Page 35: Using The Bea Weblogic Server 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.
  • Page 36 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...
  • Page 37: Starting The Message Editor

    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 ). Make sure that your classpath is set correctly. setExamplesEnv.cmd Sample message catalog files are located in your directory.
  • Page 38: Working With Catalogs

    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: Browsing to an Existing Catalog Creating a New Catalog...
  • Page 39: Browsing To An Existing Catalog

    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 directory. BEA_HOME\samples\wlserver7.0\samples\examples\i18n\msgcat Note: This directory path may vary, depending on where you chose to install WebLogic Server.
  • Page 40 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 Internationalization Guide Figure 3-4.
  • Page 41: Creating A New Catalog

    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”...
  • Page 42 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 the WebLogic catalog directory, 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.
  • Page 43: 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.
  • Page 44 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.
  • Page 45: Entering A New Simple Text Message

    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.
  • Page 46: Finding Messages

    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:...
  • Page 47: Finding A Simple Text Message

    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.
  • Page 48: Using The Message Viewer

    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.
  • Page 49: Viewing All Messages In Several Catalogs

    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.
  • Page 50: Editing An Existing Message

    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 Finding a Log Message...
  • Page 51: Using The Bea Weblogic Server Internationalization Utilities

    HAPTER 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...
  • Page 52: About The Weblogic Server Internationalization And Localization Interfaces

    Using the BEA WebLogic Server Internationalization Utilities 18ngen Utility used for localizing text in log messages. l10ngen Utility process locale-specific catalogs. CatInfo Utility generate a list of installed log messages. Note: Text in the catalog definitions may contain formatting characters for readability (for example, end of line characters), but these are not preserved by the parsers.
  • Page 53 About the WebLogic Server Internationalization and Localization Interfaces As another example, when the programs.utils.MyUtilLogger.class in the catalog, this class contains static public methods as defined by the attribute. classes are generated for each simple message catalog. These classes TextFormatter include static methods for accessing localized and formatted text from the catalog.
  • Page 54: 18Ngen Utility

    Using the BEA WebLogic Server Internationalization Utilities The output prints the message text in the current locale, with the inserted appropriately. 18ngen Utility i18ngen TextFormatter message catalogs are compiled into Java classes and properties files. The utility also creates or updates the...
  • Page 55: L10Ngen Utility

    -i18n -l10n -compile -nobuild files l10ngen Utility l10ngen subordinate to the top-level catalogs. Syntax java -classpath <l10n_Classpath> weblogic.i18ntools.l10ngen [options] filelist where <l10n_Classpath> Home>/lib/weblogic.jar Creates the internationalizer source (for example, ) that supports the logging of *Logger.java internationalized messages. Creates the localizer source (property resource bundles) that provides access to each message defined in each message catalog.
  • Page 56: Options

    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 Directory in which to place properties. Default is the -d targetdirectory current directory.
  • Page 57: Options

    Options Note: All options may be abbreviated to a single character. Option -id nnnnnn -subsystem identifier -detail -help To export the detailed list of messages to a file, use the following command: java weblogic.i18ntools.CatInfo -detail > Errors.txt Definition where nnnnnn represents the message ID. option is used to specify a particular message.
  • Page 58 Using the BEA WebLogic Server Internationalization Utilities Internationalization Guide...
  • Page 59: Localizer Class Reference For Bea Weblogic Server

    LogLocalizer ejbLogLocalizer. class methods is provided as reference for Localizer are classes that are used by applications and server code to localize text utility creates i18ngen Localizer class is generated for each catalog file. The name of the class is the extension, which is stripped by the utility), followed .xml...
  • Page 60: Localizer Methods

    Localizer Class Reference for BEA WebLogic Server Localizer Methods Localizers additional methods are provided to simplify the access of the localization data in the . These methods are described in Localizer Table A-1 Methods for Localization Data Access Method public Object getObject(String key, String id)
  • Page 61: 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. argument to the return. Acceptable values are defined in the text can be further expanded through message body elements, message ID...
  • Page 62 Localizer Class Reference for BEA WebLogic Server Localizer class For example, message weblogic.i18n.ejbLogLocalizer file: 001234=EJB:weblogic.i18n.ejbLogLocalizer Internationalization Guide is the name of the generated Localizer is identified as an EJB subsystem message ID from the 001234 class by the following property in the lookup...
  • Page 63: Logger Class Reference For Bea Weblogic Server

    The classes generated by interface to WebLogic Server error logging. For catalog XyzLogger Logger WebLogic Server log. The methods included are the same as those defined in the associated catalog. If the catalog specifies the methods are also generated for each message. Loggable...
  • Page 64: Example Of A Generated Logger Class

    Logger Class Reference for BEA WebLogic Server Example of a Generated Logger Class Listing B-1 Listing B-1 Example of Message Catalog <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls600/msgcat.dtd"> <message_catalog i18n_package="examples.i18n.logging" l10n_package="examples.i18n.logging" subsystem="I18N" version="1.0" baseid="600000" endid="610000" loggables="true" > <logmessage messageid="600000"...
  • Page 65 stacktrace="true" > <messagebody>This message is followed by a trace</messagebody> <messagedetail></messagedetail> <cause></cause> <action></action> </logmessage> <logmessage messageid="600003" method="logNoTrace(Throwable t)" severity="warning" stacktrace="false" > <messagebody>This message is not followed by a trace, but we can insert its text : {0}</messagebody> <messagedetail></messagedetail> <cause></cause> <action></action> </logmessage> <logmessage messageid="600004"...
  • Page 66 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:...
  • Page 67 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 };...
  • Page 68 Logger Class Reference for BEA WebLogic Server * messageid: 600004 * severity: info public static String getId() Object [] args = { MessageLogger.log( "600004", args, "examples.i18n.logging.I18nLogLogLocalizer"); return "600004"; public static Loggable getIdLoggable() throws MissingResourceException { Object[] args = { return new Loggable("600004", args);...
  • Page 69 * @author Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved. * This example shows how to use the internationalized (I18n) logging interfaces. * <p> * usage: java examples.i18n.logging.I18nLog * <p>...
  • Page 70 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.
  • Page 71 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.println(fmt.cause(messageId,lclDetail.getCause(messageId))); System.out.println(fmt.action(messageId,lclDetail.getAction(messageId))); Listing B-2 Listing B-4 Example of Generated Logger Class Example of a Generated Logger Class shows the corresponding java source generated by i18ngen Internationalization Guide...
  • Page 72 Logger Class Reference for BEA WebLogic Server B-10 Internationalization Guide...
  • Page 73: Loggable Object Reference For Bea Weblogic Server

    How Loggable Objects Are Used About Loggable Objects By default, all log message catalogs create to log the messages to the WebLogic Server log. The include methods that return a Loggable objects are useful when you want to generate the log message but actually log it at a later time.
  • Page 74: How Loggable Objects Are Used

    Loggable Object Reference for BEA WebLogic Server How Loggable Objects Are Used To create a Logger set the loggables For example, consider the test.xml catalog shown in Listing C-1 test.xml Message Catalog <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls600/msgcat.dtd">...
  • Page 75 (Throwable)—returns a Loggable object logIOErrorLoggable class can be used as shown in Loggable 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();...
  • Page 76 Loggable Object Reference for BEA WebLogic Server Internationalization Guide...
  • Page 77: Textformatter Class Reference For Bea Weblogic Server

    PPENDIX TextFormatter Class Reference for BEA WebLogic Server The following sections provide reference information for About TextFormatter Classes Example of an Application Using a TextFormatter Class Note: This information on methods for normal usage. Normally, users will not need to use these interfaces directly.
  • Page 78: Example Of An Application Using A Textformatter Class

    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 <?xml version="1.0" encoding="UTF-8"?>...
  • Page 79 Example of an Application Using a TextFormatter Class </message> <!-- --> <message messageid="NTH_HELLO" datelastchanged="967575770971" method="nthHello(int count)" > <messagebody> This is hello number {0,number}. </messagebody> </message> <!-- --> <message messageid="VERSION" datelastchanged="967578656214" method="version(String version)" > <messagebody> Catalog version: {0} </messagebody> </message> <!-- -->...
  • Page 80 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.L10nLookup; * @author Copyright (c) 2000 by BEA Systems, Inc. All Rights Reserved. * This example shows various ways of internationalizing an application * using simple message catalogs. * <p>...
  • Page 81 Example of an Application Using a TextFormatter Class * using the catalog editing utility, weblogic.i18ntools.gui.MessageEditor. * <p> * <pre> * English(base language) * French * </pre> * <p> * To build this example run the bld.sh(UNIX) or bld.cmd (NT) scripts from * the examples/i18n/simple directory.
  • Page 82 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.
  • Page 83 Example of an Application Using a TextFormatter Class Listing 4-5 Example of Generated TextFormatter Class for the HelloWorld Catalog <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" "http://www.bea.com/servers/wls600/msgcat.dtd"> <message_catalog l10n_package="examples.i18n.simple" subsystem="I18N" version="1.0" > <message messageid="HELLO_WORLD" datelastchanged="967575717875" method="helloWorld()" > <messagebody> Hello World! </messagebody>...
  • Page 84 TextFormatter Class Reference for BEA WebLogic Server <!-- --> <message messageid="VERSION" datelastchanged="967578656214" method="version(String version)" > <messagebody> Catalog version: {0} </messagebody> </message> <!-- --> <message messageid="I18N_PACKAGE" datelastchanged="967578691394" method="i18nPackage(String pkg)" > <messagebody> I18n Package: {0} </messagebody> </message> <!-- --> <message messageid="L10N_PACKAGE" datelastchanged="967578720156"...
  • Page 85 Example of an Application Using a TextFormatter Class Internationalization Guide...
  • Page 86 TextFormatter Class Reference for BEA WebLogic Server D-10 Internationalization Guide...
  • Page 87 Index argument key A-2 message 2-4 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...
  • Page 88 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 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...

Table of Contents

Save PDF