Home
BEA WebLogic Server User's Manual
Contents
1. Last updated Fii Nuv 1d 14 51 23 CST 2001 Message ID 5 JUUUZ Get next It Comment Method IzgT ac eT rowa zle t Sevennye error T Thi m29c aq Iz TcliCve2d by a traze x N enLuu nt EN Catalog H nLog zml Weszageld Wetrod Go ment seven Bzdy Letil t on Zeus 630000 WaEn vie Slarli Bi 63000 testrys Sir zeb g Cle ss 0 sta in Mr iny recruit Ir 1713 messen 6 30003 10 3 OT a e T warnt q Te me q 630004 gelu uie Tis masa Avwesaze 3 Nel ny lo du 7 ie issa ANNINA shmldzElri nfr TR zievi its Editing an Existing Message 3 16 To edit an existing message complete the following procedure l 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 Edit the fields you wish to change in the main Message Editor window Click Update The message is updated and the entire catalog is immediately written to disk Internationalization Guide CHAPTER 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 Abo
2. 3 12 Internationalization Guide 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 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 Choose Edit from the main menu bar Choose Search to display the Search for Simple Message dialog as shown in Figure 3 9 Figure 3 9 Search for Simple Message Search for Simple Message x Message ID Message text search Findnext Cancel 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 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 Internationalization Guide 3 13 3 Using the BEA WebLogic Server Mess
3. Listing 4 1 Example of a TextFormatter Class package my text public class xyzTextFormatter public String getErrorNumber int err Listing 4 2 shows an example of how the getErrorNumber method could be used in code Listing 4 2 Example of getErrorNumber Method import my text xyzTextFormatter xyzTextFormatter xyzL10n new xyzTextFormatter System out println xyzL10n getErrorNumber someVal Internationalization Guide 4 3 4 Using the BEA WebLogic Server Internationalization Utilities The output prints the message text in the current locale with the someva1 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 i 18ngen utility also creates or updates the 118n user properties file Any errors warnings or informational messages are sent to stderr Syntax java weblogic il8ngen options files 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 Specifies the root directory to which generated Java source files are targeted User catalog properties are placed in il8n user properties relative to the designated target
4. m Localizer classis the name ofthe generated Localizer class For example message 001234 is identified as an EJB subsystem message ID from the weblogic il8n ejbLogLocalizer class by the following property in the lookup file 001234 EJB weblogic il8n ejbLogLocalizer A 4 Internationalization Guide APPENDIX B Logger Class Reference for BEA WebLogic Server The following sections provide reference information for Logger classes m About Logger Classes m 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 i 18ngen are known as Loggers Logger classes provide the interface to WebLogic Server error logging For catalog Xyz xml a Logger class XyzLogger is generated The Logger class provides methods to log all messages defined in a catalog to the WebLogic Server log The methods included are the same as those defined in the associated catalog If the catalog specifies the loggables attribute to be true then Loggable methods are also generated for each message Internationalization Guide B 1 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 lt xml version 1 0 encoding UT
5. The following list shows the severity values that are returned E weblogic logging severities EMERGENCY E weblogic logging severities ALERT W weblogic logging severities CRITICAL E weblogic logging severities ERROR W weblogic logging severities WARNING E weblogic logging severities NOTICE W weblogic logging severities INFO W weblogic logging severities DEBUG 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 returned text can be further expanded through 5ava text MessageFormat format The message body detail cause and action elements are all localizable The other elements message ID severity and subsystem are not localizable and do not require further processing by MessageFormat Localizer Lookup Class To obtain the correct Localizer for a message use the L10nLookup class L10nLookup is a Property class extension that is loaded at system startup from the property file weblogic il8n il8n 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 m nnnnnn is the message ID m subsystemis the related subsystem Internationalization Guide A 3 A Localizer Class Reference for BEA WebLogic Server
6. severity warning i4 public static String logNoTrace Throwable arg0 Object args arg0 MessageLogger log 600003 args examples il8n logging 118nLogLogLocalizer return 600003 public static Loggable logNoTraceLoggable Throwable arg0 throws MissingResourceException Object args arg0 return new Loggable 600003 args This message s id will be in the next messag Qexclude Internationalization Guide 0 B 5 B Logger Class Reference for BEA WebLogic Server messageid 600004 severity info public static String getId Object args i MessageLogger log 600004 args examples il8n logging I18nLogLogLocalizer return 600004 public static Loggable getIdLoggable throws MissingResourceException Object args return new Loggable 600004 args The previous message logged had message id 0 exclude messageid 600005 severity info public static String showId String arg0 Object args arg0 MessageLogger log 600005 args examples il8n logging I18nLogLogLocalizer return 600005 public static Loggable showldLoggable String arg0 throws MissingResourceException Object args arg0 return new Loggable 600005 args OR OX He X Listing B 3 shows an example application that uses the i18nLog Listing B 3 Example of Application Using il8nLog package examples i
7. Program Interfaces APIs that are used by WebLogic Server nternationalization Internationalization Guide 1 1 1 Overview of Internationalization for WebLogic Server T18N 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 This data is predominantly dynamic and contains information that is specific to the current state of the application and system When merged with text in a localized log message catalog this data results in well formatted localized messages that describe the error condition in the language of the user The output sent to the console is simple text As with log messages simple text can be merged with dynamic data The information covered in this guide addresses only the internationalization of textual data Understanding Localization for WebLogic Server 1 2 Localization covers not only language but collation date and time formats monetary formats and character encoding Messages that are logged to the WebLogic Server error log can be localized to meet your particular requirements WebLogic Server internationalization supports localization of two typ
8. messagebody This is hello number 0 number lt messagebody gt lt message gt Kiso ms lt message messageid VERSION datelastchanged 967578656214 method version String version gt lt messagebody gt Catalog version 0 lt messagebody gt lt message gt ls uem lt message messageid I18N PACKAGE datelastchanged 967578691394 method il8nPackage String pkg lt messagebody gt I18n Package 0 messagebody lt message gt lt ser lt message messageid L10N_PACKAGE datelastchanged 967578720156 method 110nPackage String pkg gt lt messagebody gt L10n Package 0 lt messagebody gt lt message gt Mee Vars lt message messageid SUBSYSTEM Internationalization Guide D 3 D TextFormatter Class Reference for BEA WebLogic Server datelastchanged 967578755587 method subSystem String sub gt messagebody Catalog subsystem 0 lt messagebody gt lt message gt message catalog 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 il8n simple import java util Locale import java text MessageFormat import weblogic il8n Localizer import weblogic il8ntools L10nLookup author Copyright c 2000 by BEA Systems Inc All Rights Reserved y This example shows various ways of inter
9. 2 10 This section provides reference information for the following simple text message catalog elements m message catalog m message m messagebody Internationalization Guide Message Catalog Formats message_catalog The following table describes the attributes that you can define for the message catalog element Attribute Default Required Description Optional 110n package weblogic il8n 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 110n package mycatTextLocalizer properties is generated subsystem None Required An acronym identifying the subsystem associated with this catalog The name of the subsystem is included in the error log and is used for message isolation purposes version None Required Specifies the version of the msgcat dtd being used The format is n n for example version 1 0 Must be at least 1 0 message The following table describes the attributes that you can define for the message element Attribute Default Required Description Optional messageid None Required Unique identifier for this log message in alpha numeric string format Uniqueness is required only within the context of this catalog message is a child element of message catalog datelastchanged None Optional Date ti
10. 22 52 CST 2001 Message ID Get next Id Comment Method Severity Message body Message detail Possible cause Action Display stacktrace 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 3 6 Internationalization Guide Working with Catalogs Figure 3 4 WebLogic Message Editor for Simple Messages 4 Weblogic Message Editor HelloWorld xml File Edit View Options WebLogic Message Catalog Editor Editing non server message catalogs Message catalog examptestit 8rimsgcatiHelloworld xmi Browse 118n package weblogicit8n L10n package examples i18n simple Subsystem 118N Version 1 0 Base id End id Simple Messages Last updated Fri Nov 16 14 22 13 CST 2001 Message ID Comment Method Message body 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 Internationalization Guide 3 7 3 Using the BEA WebLogic Server Message Editor 3 8 Figure 3 5 Create New Catalog Create new catalog Lx Message catalog Browse Catalog type Log messages v 118n pac
11. 4 6 VIAN e aa EER DE avt EE AD ER DR te ebat ee 4 6 uu ni EE EE EE ses da i dea EE 4 7 Localizer Class Reference for BEA WebLogic Server About Localizer Classes eee eee eee ee ee ee enne nens A 1 Localizer Methodis ee ee ee ee Re ee ee ee ee nre en nnne A 2 Localizer Lookup Class scie EES EERS ER see ini Ee Ee GE eee e ee i ii A 3 Logger Class Reference for BEA WebLogic Server About Logger Classes ss GEE EE Ee ted ed n Rede dete B 1 Example of a Generated Logger Class enma nene aaa B 2 Loggable Object Reference for BEA WebLogic Server About Loggable Objects ee e c e a e ee a ta ee ddd C 1 How Loggable Objects Are Used nene nana C 2 TextFormatter Class Reference for BEA WebLogic Server About TextFormatter Classes nene nana nenea D 1 Example of an Application Using a TextFormatter Class iese sees see see D 2 Hybrid Templates for FrameMaker 5 5 V vi Hybrid Templates for FrameMaker 5 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 m Chapter 1 Overview of Internationalization for WebLogic Server summarizes the processes required for internationalization and localization m Chapter 2 Using Message Catalogs with BEA WebLogic Server describe
12. Server sss 1 2 Understanding Message Catalogs men nenea nenea ae 1 3 Understanding Java Interfaces for Internationalization nene eee 1 4 Main Steps for Creating an Internationalized Message iese se nenea 1 4 2 Using Message Catalogs with BEA WebLogic Server Overview of Message Catalog eee nenea neam ee ee Re 2 1 Message Catalog Hierarchy esses eene 2 2 Choosing Names for Message Catalogs see 2 3 Using Message Arguments nennen enne nennen nennen 2 4 Message Catalog Formats sss 2 5 Elements of a Log Message Catalog 2 5 message catalog eee E RE NF Re 2 6 log imessadge i ecc ecua oaia aice E EE EE N 2 7 Other log message Catalog Elements ce nenea nene 2 8 Log Message Catalog Example ies nene nenea aan 2 9 Elements of a Simple Text Message Catalog 2 10 Hybrid Templates for FrameMaker 5 5 iii Message catalog EE wh dearer ai e d a e cour aa a 2 11 MESSAGE ue qe ee REG shat ed ate e re s 2 11 messagebody i N ice aa on deeem OE N Ri 2 12 Simple Text Catalog Example iese se ee nene nana ae 2 13 Elements of a Locale Specific Catalog eee nenea 2 14 locale message catalog 2 14 log messages en ede rre REEF HR daia 2 14 Otherlocale message catalog Elements 2 14 Locale Message Catalog Syntax sese 2 15 3 Using the BEA WebLogic Server Message Editor About the Message Edit
13. 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 documentation where to find it viii DTDs 2 2 E elements locale specific catalog 2 14 log message catalog 2 5 simple text message catalog 2 10 I18n package 3 8 il8ngen 4 4 Internationalization definition of 1 1 Internationalization Interfaces Java 1 4 J Java Development Kit JDK 1 4 Java internationalization interfaces 1 4 K key argument A 2 L L10n package 3 8 110n_msgcat dtd 2 2 110ngen 4 5 L10nLookup A 3 locale specific catalog 2 14 Localization Hybrid Templates for FrameMaker 5 5 I i 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 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 editor about 3 1 starting 3 3 Message IDs 1 3 Message Viewer 3 14 message finding a simple text message 3 13 method Localizer A 2 Logger 1 5 TextFormatter 1 5
14. directory Files are placed in appropriate directories based on the 118n package and 110n package values in the corresponding message catalog The default target directory is the current directory n Parse and validate but do not generate classes keepgenerated Keep generated Java source ignore Ignore errors 4 4 Internationalization Guide I10ngen Utility 110ngen Utility Syntax il8n Creates the internationalizer source for example Logger java that supports the logging of internationalized messages 110n 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 Errors detected during compilation generally result in no class files or properties file being created il 8ngen exits with a bad exit status nobuild Parse and validate only files Process the files and directories in this list of files If directories are listed the command processes all XML files in the listed directories The names of all files must include an XML suffix All files must conform to the msgcat dtd syntax il8ngen prints the fully qualified list of names Java source to the stdout log for those files actually generated
15. get the next unique numerical ID in the context catalog Enter the appropriate Method for your log message including parentheses and any arguments For example logNoAuthorization String arg0 java util Date argl int arg2 logNote Choose a Severity from the list of possible levels 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 Internationalization Guide 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 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 gt WebLogic Message Editor HelloWorld xml File Edit View Options WebLogic Message Catalog Editor Editing non server message catalogs Messag
16. lt messagebody gt lt messagedetail gt lt messagedetail gt lt cause gt lt cause gt lt action gt lt action gt lt logmessage gt lt logmessage messageid 600004 method getId severity info gt but we lt messagebody gt This message s id will be in the next message lt messagebody gt lt messagedetail gt A message can contain additional detailed information lt messagedetail gt lt cause gt This message is displayed on purpose lt cause gt lt action gt Nothing to do the example is working lt action gt lt logmessage gt lt logmessage messageid 600005 method showld String id severity info gt lt messagebody gt The previous message logged had message id 0 lt messagebody gt lt messagedetail gt lt messagedetail gt lt cause gt lt cause gt lt action gt lt action gt lt logmessage gt lt message_catalog gt Listing B 2 shows the corresponding java source generated by i18ngen Internationalization Guide B 3 B Logger Class Reference for BEA WebLogic Server Listing B 2 Example of Generated Logger Class package examples il8n 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
17. name For example for a catalog called mycat xmla properties file called li0n package mycatLogLocalizer properties is generated subsystem None Required An acronym identifying the subsystem associated with this catalog The name of the subsystem is included in the error log and is used for message isolation purposes version None Required Specifies the version of the msgcat dtd being used The format is n n for example version 1 0 Must be at least 1 0 baseid 000000 for Optional Specifies the lowest message ID used in this WebLogic Server catalog The syntax is one to six decimal units catalogs 500000 for user defined catalogs 2 6 Internationalization Guide Message Catalog Formats Attribute Default Required Description Optional endid 499999 for Optional Specifies the highest message ID used in this WebLogic Server catalog The syntax is one to six decimal units catalogs 999999 for user defined catalogs log message The following table describes the attributes that you can define for the 1og message element Attribute Default Required Description Optional messageid None Reguired Unigue identifier for this log message Unigueness should extend across all catalogs Value must be in range defined by baseid and endid attributes This is a child element of message catalog datelastchanged None Optional Date time stamp used for managing modifications to this message The date
18. the manual method then you must manually apply the argument to the text using the MessageFormat class sy String text 110n get NTH HELLO Object args new Integer 4 System out printin MessageFormat format text args The Localizer class also provides methods for accessing catalog information 4 System out printin fmt version 110n getVersion System out println fmt l10nPackage 110n getL1l0nPackage System out println fmt il8nPackage 110n getI18nPackage System out printin fmt subSystem 110n getSubSystem Listing 4 5 shows an example of the generated Text Formatter for the HelloWorld catalog D 6 Internationalization Guide Example of an Application Using a TextFormatter Class Listing 4 5 Example of Generated TextFormatter Class for the HelloWorld Catalog lt xml version 1 0 encoding UTF 8 lt DOCTYPE message catalog PUBLIC weblogic message catalog dtd http www bea com servers wls600 msgcat dtd message catalog 110n package examples il8n simple subsystem I18N version 1 0 gt lt message messageid HELLO WORLD datelastchanged 967575717875 method helloWorld gt lt messagebody gt Hello World lt messagebody gt lt message gt K1 gt lt message messageid HELLO AGAIN datelastchanged 967575717804 method helloAgain gt lt messagebody gt Hello again lt messagebody gt lt message gt lt gt lt me
19. Create new catalog dialog closes and the catalog you just created is displayed as the context catalog in the main Message Editor window Internationalization Guide Adding Messages to Catalogs Adding Messages to Catalogs The following sections describe how to use the Message Editor to add messages to catalogs m Entering a New Log Message m 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 Internationalization Guide 3 9 3 Using the BEA WebLogic Server Message Editor 3 10 Figure 3 6 Log Messages amp WebLogic Message Editor 118nLog xml File Edit View Options WebLogic Message Catalog Editor Editing non server message catalogs Message catalog llestexamplestit Snimsacati1 8nLog xrml Browse 118n package examples i18n logging L10n package examples i18n logging Subsystem 118N Version Base id 600000 End id Log Messages Last updated Fri Nov 16 14 22 52 CST 2001 Message ID Get next Id Comment Method Severity Message body Message detail Possible cause Action Display stacktrace Enter a unique alphanumeric Message ID or click Get next ID to
20. D The DTDs are stored in the msgcat directory The location of the msgcat directory may vary depending upon where you installed WebLogic Server If you used the default installation path the msgcat directory is located in the BEA HOME directory under WL_HOME samples server src examples il8n msgcat Two DTDs are included in the WebLogic Server distribution m msgcat dtd Describes the syntax of top level default catalogs m 110n_msgcat dtd Describes the syntax of locale specific catalogs The msgcat directory also contains templates that you can use to create top level and locale specific message catalogs Users may choose to create a single log message catalog for all their logging requirements or create smaller catalogs based on a subsystem or Java package We recommend using multiple subsystems because you can focus on specific portions of the log during viewing For simple text catalogs the recommended approach is to create a single catalog for each utility being internationalized Developers can create site specific message catalogs using the Message Editor as described in Using the BEA WebLogic Server Message Editor on page 3 1 Message Catalog Hierarchy All messages and exceptions must be defined in the default top level catalog The WebLogic Server distribution includes a collection of sample catalogs in the WL HOME samples server src examples il8n msgcat directory 2 2 Internationalization Guide Choosing N
21. ERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE FURTHER BEA Systems DOES NOT WARRANT GUARANTEE OR MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE USE OF THE SOFTWARE OR WRITTEN MATERIAL IN TERMS OF CORRECTNESS ACCURACY RELIABILITY OR OTHERWISE Trademarks or Service Marks BEA Jolt Tuxedo and WebLogic are registered trademarks of BEA Systems Inc BEA Builder BEA Campaign Manager for WebLogic BEA eLink BEA Manager BEA WebLogic Commerce Server BEA WebLogic Enterprise BEA WebLogic Enterprise Platform BEA WebLogic Express BEA WebLogic Integration BEA WebLogic Personalization Server BEA WebLogic Platform BEA WebLogic Portal BEA WebLogic Server BEA WebLogic Workshop and How Business Becomes E Business are trademarks of BEA Systems Inc All other trademarks are the property of their respective companies Internationalization Guide Part Number Document Revised Software Version N A August 20 2002 BEA WebLogic Server Version 7 0 Contents About This Document Audience s o ae eie RENE OE RN ES viii e docs WebSite dte aret RE e E UE viii How to Print the Document nnne enne viii Related Information esee edis ix Contact OM tea TR EE RU OE EE N ix Documentation Conventions eee na nana nenea nea nana nn X 1 Overview of Internationalization for WebLogic Server About Internationalization and Localization Standards iese see ee ee ee 1 1 Understanding Localization for WebLogic
22. 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 1n catalog entries The catalog currently being created or used in the Message Editor is the context catalog The catalog parsers 118ngen or 110ngen 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 amp amp lt lt amp gt gt amp apos E amp quot M 3 2 Internationalization Guide 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 0Nsamples examples V il8n 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 we
23. F 8 gt lt DOCTYPE message catalog PUBLIC weblogic message catalog dtd http www bea com servers wls600 msgcat dtd message catalog il8n package examples il8n logging 110n package examples il8n logging subsystem I18N version 1 0 baseid 600000 endid 610000 loggables true gt lt logmessage messageid 600000 method logEntry severity info gt messagebody Starting I18nLog example lt messagebody gt lt messagedetail gt lt messagedetail gt lt cause gt lt cause gt lt action gt lt action gt lt logmessage gt lt logmessage messageid 600001 method testArgs String name int cnt severity debug gt lt messagebody gt Class 0 started with 1 number arguments lt messagebody gt lt messagedetail gt lt messagedetail gt lt cause gt lt cause gt lt action gt lt action gt lt logmessage gt lt logmessage messageid 600002 method logTrace Throwable t severity error B 2 Internationalization Guide Example of a Generated Logger Class stacktrace true gt lt messagebody gt This message is followed by a trace lt messagebody gt lt messagedetail gt lt messagedetail gt lt cause gt lt cause gt lt action gt lt action gt lt logmessage gt lt logmessage messageid 600003 method logNoTrace Throwable t severity warning stacktrace false gt lt messagebody gt This message is not followed by a trace can insert its text 0
24. The 110ngen utility processes the locale specific catalogs in directories that are subordinate to the top level catalogs java classpath lt 110n Classpath gt weblogic il8ntools 110ngen options where lt 110n Classpath gt should include lt WebLogic Home lib weblogic jar Internationalization Guide 4 5 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 1s 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 a11 country code Country code Default is a11 variant code Variant code Default is a11 filelist Message catalog directories and files to process relative to the current directory Identifies top level not local specific directory CatInfo Utility This utility generates a listing of installed log messages By default CatInfo lists in order the ID and message body for all currently installed log messages Syntax java weblogic il8ntools CatInfo options 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 4 6 Internationalization Guide CatInfo Utility Options Note All options may be abbreviated to a single char
25. acter Option Definition id nnnnnn where nnnnnn represents the message ID The id option 1s 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 help Provides usage information To export the detailed list of messages to a file use the following command java weblogic il8ntools CatInfo detail Errors txt Internationalization Guide 4 7 4 Using the BEA WebLogic Server Internationalization Utilities 4 8 Internationalization Guide APPENDIX A Localizer Class Reference for BEA WebLogic Server The following sections provide reference information for Localizer classes m About Localizer Classes m Localizer Methods m 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 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 xm1 exte
26. age 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 The following sections describe how to use the Message Viewer to view and choose messages to edit m Viewing All Messages in a Catalog m Viewing All Messages in Several Catalogs m Choosing a Message to Edit from the Message Viewer Viewing All Messages in a Catalog To view all the messages in a catalog 1 Openthe 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 3 14 Internationalization Guide Using the Message Viewer Figure 3 10 Message Viewer 11 8nLog xml jol Catalog I18nLog xml Message Id Method Comment Severity Body Detail Action Cause 600000 logEntryd info Starting I18n 600001 testArgs Strin debug Class 0 star 600002 logTrace Thr error This messag 600003 logNoTrace T warning This messag 600004 getild info This messag A message c Nothing to do This messag 600005 showld Strin inf
27. ames for Message Catalogs Note This directory path may vary depending on where you chose to install WebLogic Server Catalogs that provide different localizations ofthe 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 xm1 and a German translation of it called VdeNmycat xml Typically the top level catalog is English but English is not required for any catalogs except the installed WebLogic Server catalogs Locale designations for example de also have a hierarchy as defined in the java util Locale documentation A locale can include a language country and variant Language is the most common locale designation Language can be extended with a country code For instance en US indicates American English The name of the associated catalog is Nen US mycat xml Variants are vendor or browser specific and are used to introduce minor differences for example collation sequences between two or more locales defined by either language or country Choosing Names for Message Catalogs Because the name of a message catalog file without the xm1 extension is used to generate runtime class and property names you should choose the name carefully Follow these guidelines for naming message catalogs m Do not choose a message catalog name that conflicts with any names of existing classes in the target package m The mes
28. atalog name followed by TextFormatter Normally one would use the default constructor to obtain formatting in the current locale In this example we ll us a locale based on arguments to construct the TextFormatter x Locale lcl if argv length 0 default is default locale for JVM lcl Locale getDefault else String lang null String country null get the language code lang argv 0 if argv length gt 2 get the country code country argv 1 lcl new Locale lang country get formatter in appropriate locale Internationalization Guide D 5 D TextFormatter Class Reference for BEA WebLogic Server x HelloWorldTextFormatter fmt new HelloWorldTextFormatter lcl fmt setExtendedFormat true print the text in the current locale sy 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 110n package attribute in the catalog the catalog name and the string TextLocalizer Xy Localizer 110n L10nLookup getLocalizer lcl examples il18n simple HelloWorldTextLocalizer System out printin 110n get HELLO AGAIN If the message accepts arguments then they can just be passed to the method defined for the message Xy System out println fmt nthHello 3 If using
29. blogic il8ntools gui MessageEditor The main WebLogic Message Editor window for Log Messages displays as shown in Figure 3 1 Internationalization Guide 3 3 3 Using the BEA WebLogic Server Message Editor Figure 3 1 WebLogic Message Editor for Log Messages WebLogic Message Editor Jol x File Edit View Options WebLogic Message Catalog Editor Editing non server message catalogs Browse I18n package n a LiOnpackage nia Subsystem na Version nia Base id na End id nia Message catalog Log Messages Last updated Fri Nov 16 14 52 41 CST 2001 Message ID Get next Id Comment Method Severity error v Message body Message detail Possible cause Action Display stacktrace Working with Catalogs The following sections describe how to use the Message Editor to manage catalogs m Browsing to an Existing Catalog m Creating a New Catalog 3 4 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 Look in E msucat Mi al amp E B amp BS C de C fr DY Helloworld xml DY nenLogxmi 3 HansimplesmI D UserS
30. by default Internationalization Guide B 7 B Logger Class Reference for BEA WebLogic Server S Throwable t new Throwable Test with stack trace I18nLogLogger logTrace t Messages can optionally be defined to not log a stack trace id I18nLogLogger logNoTrace t The logger methods return the messageid for applications that want to do more than just log these messages hA String messageId Il8nLogLogger getId I18nLogLogger showId messageld the message id can be used to obtain the different attributes of a message The LlOnLookup object provides access to the catalogs via Localizer classes Localizers provide the access to individual messages Each log message catalog has two Localizers one for general message information and one for the detailed attributes The basic Localizer provides access to catalog information Version L10n Package package for catalog data T18n Package package for Logger methods Subsystem catalog subsystem For each message it also provides Severity debug 128 info 64 warning 32 error 8 Message Body the message text Stack option whether to log a stack trace R ox ME ORO OR O3 N DE XXX OS OB AE 3 GE First get to the L10nLookup properties then use them to get th Localizer s for the message x xf L10nLookup 110n L10nLookup getL10n This returns the basic Localizer arg 3 false ard Localizer lcl 110n getLoca
31. d Log Message Catalog Example The following example shows a log message catalog MyUtilLog xml with one log message Listing 2 2 Example of a Log Message Catalog lt xml version 1 0 gt lt DOCTYPE message catalog PUBLIC weblogic message catalog dtd http www bea com servers wls700 dtd msgcat dtd message catalog 110n package programs utils il8n package programs utils subsystem MYUTIL Internationalization Guide 2 9 2 Using Message Catalogs with BEA WebLogic Server version 1 0 baseid 600000 endid 600100 lt log_message messageid 600001 severity warning method logNoAuthorization String arg0 java util Date argl int arg2 lt messagebody gt Could not open file 0 on 1 date after 2 number attempts lt messagebody gt lt messagedetail gt 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 lt messagedetail gt lt cause gt The user is not authorized to use custom configurations Custom configuration information resides in file 0 created on 1 date but is not readable The attempt has been logged to the security log lt cause gt lt action gt The user needs to gain approriate authorization or learn to live with the default settings lt action gt lt log_message gt message catalog Elements of a Simple Text Message Catalog
32. d document date of your documentation 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 You can also contact Customer Support by using the contact information provided on the Customer Support Card which is included in the product package When contacting Customer Support be prepared to provide the following information m Your name e mail address phone number and fax number m Your company name and company address m Your machine type and authorization codes m The name and version of the product you are using m A description of the problem and the content of pertinent error messages Internationalization Guide ix 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 Code samples commands and their options Java classes data types text directories and file names and their extensions Monospace text also indicates text that you enter from the keyboard Examples import java util Enumeration chmod utw config examples applications java config xml float monospace Variables in code italic text Example String CustomerName UPPERCASE Device names environment variables and log
33. e catalog fexamplesiit 8nimsgcatiHelloWorld xml Browse M8npackage weblogic i18n L10n package examples i18n simple Subsystem VAN Version 1 0 Base id End id Simple Messages Last updated Fri Nov 16 14 22 13 CST 2001 Message ID Comment Method Message body 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 Internationalization Guide 3 11 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 m Finding a Log Message m 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 Search for Log Message LX Message ID Method Message text search Find first Find next Cancel 4 Enter the Message ID and the Method name
34. ee eo amp g PE dy ea BEA WebLogic Server Internationalization Guide Release 7 0 Document Revised August 20 2002 Copyright Copyright O 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 This document may not in whole or in part be copied photocopied reproduced translated or reduced to any electronic medium or machine readable form without prior consent in writing from BEA Systems Inc Use duplication or disclosure by the U S Government is subject to restrictions set forth in the BEA Systems License Agreement and in subparagraph c 1 of the Commercial Computer Software Restricted Rights Clause at FAR 52 227 19 subparagraph c 1 11 of the Rights in Technical Data and Computer Software clause at DFARS 252 227 7013 subparagraph d of the Commercial Computer Software Licensing clause at NASA FAR supplement 16 52 227 86 or their equivalent Information in this document is subject to change without notice and does not represent a commitment on the part of BEA Systems THE SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND INCLUDING WITHOUT LIMITATION ANY WARRANTY OF M
35. entation is available on the BEA corporate Web site From the BEA Home page click on Product Documentation How to Print the Document viii 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 A PDF version of this document is available on the WebLogic Server documentation Home page on the e docs Web site and also on the documentation CD You can open the PDF in Adobe Acrobat Reader and print the entire document or a portion of it in book format To access the PDFs open the WebLogic Server documentation Home page click Download Documentation and select the document you want to print Adobe Acrobat Reader is available at no charge from the Adobe Web site at http www adobe com Internationalization Guide Related Information For more information in general about internationalization and localization refer to the following sources m The Java Developer Connection at java sun com m 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 Your comments will be reviewed directly by the BEA professionals who create and update the documentation In your e mail message please indicate the software name and version you are using as well as the title an
36. erence for BEA WebLogic Server B 10 Internationalization Guide APPENDIX C Loggable Object Reference for BEA WebLogic Server The following sections provide reference information for Loggable objects m About Loggable Objects m 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 Loggable objects are useful when you want to generate the log message but actually log it at a later time They are also useful if you want to use the message text for other purposes such as throwing an exception Internationalization Guide C 1 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 lt xml version 1 0 encoding UTF 8 lt DOCTYPE message catalog PUBLIC weblogic message catalog dtd http www bea com servers wls600 msgcat dtd message catalog subsystem Examples version 1 0 baseid 500000 endid 500001 loggables true gt lt logmessage messageid 500000 severity error method logIOError Th
37. erverSCExample xml 3 UserServersvExample xml File name I18nLog xml Files of type xml files Cancel The sample catalogs included with your WebLogic Server installation are in the BEA_HOME samples wlserver7 0 samples examples il8n 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 Internationalization Guide 3 5 3 Using the BEA WebLogic Server Message Editor Figure 3 3 WebLogic Message Editor for Log Messages File Edit View Options WebLogic Message Catalog Editor Editing non server message catalogs Message catalog lestexamplestit Bnimsgcatilt BnLog xmi Browse I8npackage examples i18n logging L10n package examples i18n logging Subsystem 118N Version 1 0 Base id 600000 End id 610000 Log Messages Last updated Fri Nov 16 14
38. es for this catalog properties are named after the catalog file name For example for a French log message catalog called mycat xml a properties file called 110n package mycatLogLocalizer fr FR properties properties is generated version None Required Specifies the version of the msgcat dtd being used The format is n n for example version 1 0 Must be at least 1 0 log message The locale specific catalog uses the attributes defined for the 10g message element in the log message catalog so this element does not need to be defined Other locale message catalog Elements The locale specific catalog uses the messagebody messagedetail cause and action catalog elements defined for the log message catalog so these elements do not need to be defined 2 14 Internationalization Guide Message Catalog Formats Locale Message Catalog Syntax The following example shows a French translation of a message that is available in MnsgcatN rMMyUtilLabels xml The translated message appears as shown in Listing 2 4 Listing 2 4 Example of a Message Translated to French lt xml version 1 0 gt lt DOCTYPE message catalog PUBLIC weblogic locale message catalog dtd http www bea com servers wls700 dtd 110n msgcat dtd locale message catalog 110n package programs utils subsystem MYUTIL version 1 0 gt lt message gt lt messageid FileMenuTitle gt lt messagebody gt Fichier lt me
39. es of data m Log messages Log messages are informational messages that are written to the server log and may also contain error messages if the appropriate message arguments are included in the message definition m 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 Internationalization Guide 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 The logging methods merge the code with the message string in the catalog per the current locale And the application code then prints a localized message in the log files There are three types of message catalogs m Log message catalogs Collections of log messages m Simple text catalogs Collections of simple text messages m Locale message catalogs Collections of locale specific messages corresponding to a top level log message or simple text catalog Message IDs in log message catalo
40. gs or locale message catalogs are unique across all log message or locale message catalogs Within the message catalog file each localized version of the message is assigned a unique message ID and message text specific to the error Ideally a message is logged from only one location within the system so that a support team can easily find it 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 for more detailed information about message catalogs Internationalization Guide 1 3 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 Locale Represents a specific geographical political or cultural region java util ResourceBundle Provides containers for locale specific objects java text MessageFormat Produces concatenated messages in a language neutral way Main Steps for Creating an Internationalized Message The following steps describe how you create an internationalized message for use with WebL
41. ical operators TEXT Examples LPTI BEA HOME OR A set of choices in a syntax line E Optional items in a syntax line Example java utils MulticastTest n name a address p portnumber t timeout s send x Internationalization Guide 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 m An argument can be repeated several times in the command line m The statement omits additional optional arguments m You can enter additional parameters values or other information Internationalization Guide xi xii Internationalization Guide CHAPTER 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 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
42. is supplied by utilities that run on the catalogs The syntax is Long toString new Date getTime severity None Required Indicates the severity of the log message Must be one of the following debug info warning notice error critical alert or emergency User catalogs may only use debug info warning and error stacktrace true Optional Indicates whether to generate a stack trace for Throwable arguments Possible values are t rue or false When the value is true a trace is generated The syntax is stacktrace true Internationalization Guide 2 7 2 Using Message Catalogs with BEA WebLogic Server Attribute Default Required Description Optional 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 Classes must also conform to java text MessageFormat conventions In general class arguments should have a useful toString method Arguments can be any valid name but should follow the convention of argn where n is 0 thru 9 There can be no more than ten 10 arguments For each argn there should be at least one corresponding placeholder in the text elements described in Other l
43. kage L10n package Subsystem Version Base id End id Create Catalog Cancel In the Message Catalog field enter the full pathname and the name of the new catalog which must include the m1 extension Or click Browse and navigate to the WebLogic catalog directory msgcat 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 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 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 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 Click Create Catalog The
44. l8n logging B 6 Internationalization Guide Example of a Generated Logger Class import java util Locale import weblogic il8n Localizer import weblogic il8ntools L10nLookup import weblogic logging Loggable author Copyright c 2000 by BEA Systems Inc All Rights Reserved 7 This example shows how to use the internationalized I18n logging interfaces REKE usage java examples il8n logging 118nLog p Build procedure run bld sh UNIX or bld cmd NT These scripts process the I18nLog xml catalog producing the logging class tt examples il8n logging I18nLogLogger tt This class contains static methods for logging messages to the WLS error log The methods and arguments are defined in the I18nLog xml catalog This example also uses a simple message catalog Il8nSimple xml amp public class I18nLog public I18nLog public static void main String argv This call just logs an info message There are no arguments defined for this method This also shows how to use the Loggable form of the method x4 Loggable 11 I18nLogLogger logEntryLoggable ll log System out println ll getMessage Here s an example of a message including a variety of arguments xy Il8nLogLogger testArgs I18nLog class getName argv length If a Throwable is passed then it will result in a stack trace being logged along with the method
45. lizer messagelId Locale getDefault false This returns the detailed Localizer arg 3 true Xf Localizer lclDetail 110n getLocalizer messageId Locale getDefault true Use this appplications simple message catalog to display the log message catalog information uf I18nSimpleTextFormatter fmt new I18nSimpleTextFormatter System out println fmt version messageId lcl getVersion System out println fmt llO0nPackage messageId lcl getL10nPackage B 8 Internationalization Guide Sys Sys Sys Sys Sys 7 Sys Sys Sys OW cem cem cem cem cem cem tem tem cout out out out out out for out out println fmt println fmt println fmt println fmt println fmt Example of a Generated Logger Class il8nPackage messageId lcl getlIl18nPackage subsystem messageld lcl getSubSystem severity messageId lcl getSeverity messageId body messageId lcl getBody messageId stack messageld lcl getStackTrace messageId the detailed information println fmt println fmt println fmt detail messageId lclDetail getDetail messageId cause messageId lclDetail getCause messageId action messageId lclDetail getAction messageld Listing B 2 shows the corresponding java source generated by i18ngen Listing B 4 Example of Generated Logger Class Internationalization Guide B 9 B Logger Class Ref
46. me stamp useful for managing modifications to this message Internationalization Guide 2 11 2 Using Message Catalogs with BEA WebLogic Server Attribute Default Required Description Optional 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 In general class arguments should have a useful toString method and the corresponding MessageFormat placeholders must be strings they must be of the form n Argument names can be any valid name There can be no more than 10 arguments For each argument there must be at least one corresponding placeholder in the messagebody element described below Placeholders are of the form n n number or n date Example method getNoAuthorization String filename java util Date creDate This example would result in a method in the TextFormatter class as follows public String getNoAuthorization String filename java util Date creDate messagebody The following table describes the child element of the message element 2 12 Internationalization Guide Message Catalog Formats Element Parent Required Description Element Optional messageb
47. msgcat directory 2 2 msgcat dtd 2 2 I ii Hybrid Templates for FrameMaker 5 5 N naming conventions classes 2 3 message catalogs 2 3 0 object Loggable C 1 P printing product documentation viii property file A 3 R related information ix S severity values A 3 stacktrace 3 11 Standards Internationalization and Localization 1 1 Subsystem 3 8 support technical ix U utilities internationalization and localization 4 1
48. nationalize simple text based utilities that you are running on WebLogic Server by specifying that those utilities must use Localizers to access text data You instument the applications with Logger and TextFormatter classes generated from the i18ngen utility Refer to 18ngen Utility on page 4 4 for detailed information about the i18ngen utility The generated Logger classes are used for logging purposes instead of the traditional method of writing English text to a log For example i18ngen generates a class xyzLogger in the appropriate package for the catalog xyz xml Internationalization Guide 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 They are convenience classes that handle the interface with the message body placeholders and MessageFormat You specify the formatting methods through the method attribute in each message definition For example if the definition of a message in a catalog includes the attribute method getErrorNumber int err the TextFormatter class shown in Listing 4 1 is generated
49. nationalizing an application using simple message catalogs lt p gt Usage java examples il8n simple HelloWorld lang country lt p gt lang is a 2 character ISO language code aq en country is a 2 character ISO country code e g US lt p gt Usage of any of the languages supported by this example presumes th xistence of the appropriate OS localization software and character encodings lt p gt The example comes with catalogs for English the default and French The catalog source is in the following files and were built D 4 Internationalization Guide Example of an Application Using a TextFormatter Class using the catalog editing utility weblogic il8ntools gui MessageEditor p pre English base language msgcat Helloworld xml French msgcat fr FR HelloWorld xml lt pre gt lt p gt To build this example run the bld sh UNIX or bld cmd NT scripts from the examples il8n simple directory CLIENT CLASSES must be set up and needs to be in the classpath when running the example ef XX OF 2b 2b public final class HelloWorld public static void main String argv The easiest method for displaying localized text is to instantiate the generated formatter class for the HelloWorld catalog This class contains convenience methods that return localized text for ach message defined in the catalog The class name is the c
50. nsion which is stripped by the utility followed by LogLocalizer A Localizer class for the catalog ejb xm1 is ejbLogLocalizer Internationalization Guide A 1 A Localizer Class Reference for BEA WebLogic Server Localizer Methods A 2 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 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 Each of the methods for accessing localization data has a key argument The following list shows the recognized values for the key argument W Tocalizer SEVERITY Localizer MESSAGE ID Localizer MESSAGE BODY Localizer MESSAGE DETAIL Localizer CAUSE Localizer ACTION With the exception ofthe Localizer SEVERITY key the localization data returned by Localizers are String objects that return an integer object Internationalization Guide Localizer Lookup Class
51. o The previous 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 on page 3 5 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 Internationalization Guide 3 15 3 Using the BEA WebLogic Server Message Editor WebLogic Message C ditor HOnLogaml Fie Edit View Options WebLagic Message Catalog Editar Edit nan server message catalogs Message batalia leztwxannp essi ziv sy za 1 neue sant mxampiesiflninggmr 1 Tin package examples tin Ingging 118N Versier 10 EUUUUU End it lin package Log Messages
52. od attribute Message Catalog Formats The catalog format for top level and locale specific catalog files is slightly different The top level catalogs define the textual messages for the base locale Locale specific catalogs only provide translations of text defined in the top level version Log message catalogs are defined differently from simple text catalogs Elements of each of these types of catalogs are described in the following sections m Elements of a Log Message Catalog m Elements of a Simple Text Message Catalog m Elements of a Locale Specific Catalog Elements of a Log Message Catalog This section provides reference information for the following elements of a log message catalog m message catalog Internationalization Guide 2 5 2 Using Message Catalogs with BEA WebLogic Server m log message m 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 Description Optional il8n package weblogic il8n 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 xml a generated logger class called il8n package mycatLogger class 110n package weblogic ii8n Optional Java package containing generated LogLocalizer properties for this catalog Classes are named after the catalog file
53. ody message Required 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 lt xml version 1 0 gt lt DOCTYPE message catalog PUBLIC weblogic message catalog dtd http www bea com servers wls700 dtd msgcat dtd message catalog 110n package programs utils il8n package programs utils subsystem MYUTIL version 1 0 lt message gt messageid FileMenuTitle lt messagebody gt File lt messagebody gt lt message gt lt message_catalog gt Internationalization Guide 2 13 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 Attribute Default Required Description Optional 110n package weblogic ii8n Optional Java package containing generated LogLocalizer or TextLocalizer properti
54. og message Catalog Elements on page 2 8 Placeholders are ofthe form n n number or n date loggables False Optional Indicates whether to generate methods to return Loggable objects for each message The syntax is loggables true Refer to Loggable Object Reference for BEA WebLogic Server on page C 1 Other log message Catalog Elements The following table describes the child elements of the log message element 2 8 Internationalization Guide Message Catalog Formats Element Parent Required Description Element Optional 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 This element may contain zero or more placeholders n that are replaced by the appropriate argument when the log message is localized cause log message Required A string describing the root cause of the problem This element may contain zero or more placeholders n that are replaced by the appropriate argument when the log message is localized action log message Required A string describing the recommended resolution This element may contain zero or more placeholders nj that are replaced by the appropriate argument when the log message is localize
55. ogic Server 1 Create or edit a top levellog catalog or simple text catalog by defining the messages in the catalog For details see Using the BEA WebLogic Server Message Editor on page 3 1 In addition to message text include information about the type and placement of any run time values that the message contains 1 4 Internationalization Guide 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 Create locale specific catalogs as required for the message catalog you created in Step 1 4 Run 110ngen to process the locale specific catalogs 5 Instrument the application to use the Logger or TextFormatter methods you generated in Step 2 When the application logs or returns a message the message Is written using the localized version of the text according to the Logger or TextFormatter methods used 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 in the WebLogic Se
56. or nenea nana ana en 3 1 Starting the Message Editor esse see see ss se see ee ee AR AR nea n Re Ee ee ee ee ee ee 3 3 Working with Catalogs nenea nenea n anna ee ee ee 3 4 Browsing to an Existing Catalog sse 3 5 Creating a New Catalog sse eene nennen eren 3 7 Adding Messages to Catalogs se ea Re RR Re Re ee ee enne 3 9 Entering a New Log Message sess 3 9 Entering a New Simple Text Message eee nana 3 11 Finding Messages ec eat ERECTAE De GE ERAN 3 12 Finding a Log Message nenea aaa ene 3 12 Finding a Simple Text Message 3 13 Using the Message Viewer anna anna enne 3 14 Viewing All Messages in a Catalog eee nana 3 14 Viewing All Messages in Several Catalogs sss 3 15 Choosing a Message to Edit from the Message Viewer 3 15 Editing n Existing Message eosdem t evi een ds 3 16 4 Using the BEA WebLogic Server Internationalization Utilities About the WebLogic Server Internationalization Utilities sse 4 1 About the WebLogic Server Internationalization and Localization Interfaces 4 2 I8ngen Utility ES Ge ces eo eo da d i 4 4 SE EE EE AEA 4 4 QOPUONs 5 P a a e doit DE datat da Sa a a td Te 4 4 HOngen Utility sie OE RE EE ad d a 4 5 iv Hybrid Templates for FrameMaker 5 5 Options ete e e Ea aa GE stt ea do da 4 6 CatInfo Utility AE EE EE oem o nga
57. rfaces directly About TextFormatter Classes TextFormatter classes are generated by i18ngen from simple message catalogs These classes provide methods for generating localized versions of message text at runtime The following section shows an example ofan application its simple message catalog and the Text Formatter class generated for the catalog Internationalization Guide D 1 D rextFormatter 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 lt xml version 1 0 encoding UTF 8 lt DOCTYPE message catalog PUBLIC weblogic message catalog dtd http www bea com servers wls600 msgcat dtd message catalog 110n package examples il8n simple subsystem I18N version 1 0 gt lt message messageid HELLO WORLD datelastchanged 967575717875 method helloWorld gt lt messagebody gt Hello World lt messagebody gt lt message gt lt lt message messageid HELLO AGAIN datelastchanged 967575717804 method helloAgain gt messagebody Hello again messagebody D 2 Internationalization Guide Example of an Application Using a TextFormatter Class lt message gt 1 message messageid NTH HELLO datelastchanged 967575770971 method nthHello int count gt
58. ropriate message content at runtime when the message is logged The following excerpt from an XML log message definition shows how you can use message arguments The argument number must correspond to one of the arguments specified in the method attribute Specifically 0 with the first argument 1 with the second and so on Listing 2 1 Example of Message Arguments messagebody Unable to open file 0 lt messagebody gt lt messagedetail gt File 0 does not exist The server will restore the fil contents from 1 resulting in the use of default values for all future requests lt messagedetail gt lt cause gt The file was deleted lt cause gt lt action gt If this error repeats then investigate unauthorized access to the file system lt action gt 2 4 Internationalization Guide 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 m 0 is used in the message body m Both are used in the message detail m Neither is used in the cause or action 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 You must assign a severity level for log messages Log messages are generated through the generated Logger methods as defined by the meth
59. rowable t gt lt messagebody gt IO failure detected lt messagebody gt lt messagedetail gt lt messagedetail gt lt cause gt lt cause gt lt action gt lt action gt lt logmessage gt message catalog When you run this catalog through the i18ngen utility a Logger class is created for this catalog with the following two methods m loglOError Throwable logs the message C 2 Internationalization Guide How Loggable Objects Are Used m loglOErrorLoggable 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 il8n testLogger try some IO catch IOException ice Loggable 1 testlogger logIOErrorLloggable ioe 1 1og log the error throw new Exception l getMessage throw new exception with same text as logged Internationalization Guide C 3 C Loggable Object Reference for BEA WebLogic Server C 4 Internationalization Guide APPENDIX D TextFormatter Class Reference for BEA WebLogic Server The following sections provide reference information for TextFormatter classes m About TextFormatter Classes m 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 inte
60. rver Administration Guide Internationalization Guide 1 5 1 Overview of Internationalization for WebLogic Server 1 6 Internationalization Guide CHAPTER 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 You compile these XML files into classes during the i18ngen utility build process Refer to 18ngen Utility on page 4 4 for more information The methods of the resulting classes are the objects used to log messages at runtime Internationalization Guide 2 1 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 The locale specific catalogs contain only the message ID the date changed and the translation of the message for the specific locale The message catalog files are defined by an XML document type definition DT
61. s message catalog types message definitions elements and arguments m Chapter 3 Using the BEA WebLogic Server Message Editor explains how to use the Message Editor that 1s included with WebLogic Server m Chapter 4 Using the BEA WebLogic Server Internationalization Utilities explains how to use the internationalization utilities included with WebLogic Server m Appendix A Localizer Class Reference for BEA WebLogic Server describes Localizer classes Localizer methods key values for Localizers and lookup properties for Localizers m Appendix B Logger Class Reference for BEA WebLogic Server describes Logger classes and provides an example of a message catalog and its corresponding Logger class m Appendix C Loggable Object Reference for BEA WebLogic Server describes loggable objects and how they are used m Appendix D TextFormatter Class Reference for BEA WebLogic Server provides and example of an application that uses a Text Formatter class Internationalization Guide vii 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 docum
62. sage catalog name should only contain characters that are allowed in class names m Follow class naming standards For example the resulting class names for a catalog named Xyz xm1 are XyzLogLocalizer and XyzLogger The following considerations also apply to message catalog files m Message IDs are generally six character strings with leading zeros Some interfaces also support integer representations Internationalization Guide 2 3 2 Using Message Catalogs with BEA WebLogic Server m 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 m 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 Only the message body section in a simple message can include arguments Arguments are values that can be dynamically set at runtime These values are passed to routines such as printing out a message A message can support up to 10 arguments numbered 0 9 You can include any subset of these arguments in any text section of the message definition although the message body should include all of the arguments You insert message arguments into a message definition during development and these arguments are replaced by the app
63. ssage messageid NTH HELLO datelastchanged 967575770971 method nthHello int count gt messagebody This is hello number 0 number lt messagebody gt lt message gt Internationalization Guide D 7 D rextFormatter Class Reference for BEA WebLogic Server Klas message messageid VERSION datelastchanged 967578656214 method version String version gt lt messagebody gt Catalog version 0 lt messagebody gt lt message gt lt gt lt message messageid I18N PACKAGE datelastchanged 967578691394 method il8nPackage String pkg gt lt messagebody gt I18n Package 0 lt messagebody gt lt message gt lt gt lt message messageid L10N PACKAGE datelastchanged 967578720156 method 110nPackage String pkg gt lt messagebody gt L10n Package 0 lt messagebody gt lt message gt sie gt lt message messageid SUBSYSTEM datelastchanged 967578755587 method subSystem String sub gt lt messagebody gt Catalog subsystem 0 lt messagebody gt lt message gt message catalog D 8 Internationalization Guide Example of an Application Using a TextFormatter Class Internationalization Guide D 9 D rextFormatter Class Reference for BEA WebLogic Server D 10 Internationalization Guide Index A argument key A 2 message 2 4 C catalog browsing for 3 5 context 3 2 creating 3 7 entering
64. ssagebody gt lt message gt locale message catalog When entering text in the messagebody messagedetail cause and action elements you must use a tool that generates valid Unicode Transformation Format 8 UTF 8 characters and have appropriate keyboard mappings installed UTF 8 is an efficient encoding of Unicode character strings that optimizes the encoding ASCII characters Message catalogs always use UTF 8 encoding The Messagelocalizer utility that is downloaded with WebLogic Server is a tool that can be used to generate valid UTF 8 characters Internationalization Guide 2 15 2 Using Message Catalogs with BEA WebLogic Server 2 16 Internationalization Guide CHAPTER 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 The Message Editor is installed when you install WebLogic Server Optionally you can also edit the XML catalogs directly in a text editor Internationalization Guide 3 1 3 Using the BEA WebLogic Server Message Editor Note The Message Editor does not support the editing of localized catalogs The Message
65. static String logEntry Object args ke MessageLogger log 600000 args examples il8n logging I18nLogLogLocalizer return 600000 LANE IE NER MEE NES EE 2 public static Loggable logEntryLoggable throws MissingResourceException Object args return new Loggable 600000 args Class 0 started with 1 number arguments x exclude messageid 600001 severity debug AA public static String testArgs String arg0 int argl 4 Object args arg0 new Integer argl MessageLogger log 600001 args examples il8n logging I18nLogLogLocalizer return 600001 B 4 Internationalization Guide Example of a Generated Logger Class public static Loggable testArgsLoggable String arg0 int argl throws MissingResourceException Object args arg0 new Integer argl return new Loggable 600001 args This message is followed by a trace Qexclude messageid 600002 severity error public static String logTrace Throwable arg0 Object args arg0 MessageLogger log 600002 args examples il8n logging 118nLogLogLocalizer return 600002 public static Loggable logTraceLoggable Throwable arg0 throws MissingResourceException Object args arg0 return new Loggable 600002 args This message is not followed by a trace but we can insert its text exclude messageid 600003
66. ut the WebLogic Server Internationalization and Localization Interfaces 18ngen Utility 110ngen Utility Catlnfo Utility About the WebLogic Server Internationalization Utilities WebLogic Server provides three internationalization utilities Internationalization Guide 4 1 4 Using the BEA WebLogic Server Internationalization Utilities m 18ngen Utility Message catalog parser Use this utility to generate classes used for localizing text in log messages m 110ngen Utility Locale specific message catalog parser Use this utility to process locale specific catalogs m CatInfo Utility Utility that lists installed log messages Use this utility to 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 Text data is normalized into a one line string All leading and trailing white space is removed All embedded end of line characters are replaced by spaces as required to preserve word separation Tabs are left intact About the WebLogic Server Internationalization and Localization Interfaces 4 2 The i18ngen utility validates message catalogs creating the necessary runtime classes for producing localized messages The 11 0ngen utility validates locale specific catalogs creating additional properties files for the different locales defined by the catalogs You can inter
Download Pdf Manuals
Related Search
Related Contents
Pioneer dvd-114 User's Manual V-Twin Mfg. Rake Neck Cup Kit This is a custom application and [ AN 0614 ] I F Rival Portable Slow Cooker User's Manual utilisation du sondeur MALETÍN DE EMERGENCIAS ULM I User`s Manual Model CA51/71HANDY CAL (Calibrator) Safety Instructions Cahier d`accompagnement pour les enseignants Copyright © All rights reserved.
Failed to retrieve file