Example Locale-Specific Catalog Message Catalog Formats

Using Message Catalogs with WebLogic Server 4-11

4.5.4.3 messagebody Element

The following table describes the child element of the message element.

4.5.5 Example Locale-Specific Catalog

The following example shows a French translation of a message that is available in ...\msgcat\fr\MyUtilLabels.xml. The translated message appears as shown in Example 4–4 . Example 4–4 Example of a Message Translated to French ?xml version=1.0? DOCTYPE message_catalog PUBLIC weblogic-locale-message-catalog-dtd http:www.bea.comserverswls90dtdl10n_msgcat.dtd locale_message_catalog l10n_package=programs.utils subsystem=MYUTIL 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 Element Parent Element Required Optional Description messagebody 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. Attribute Default Value Required Optional Description 4-12 Oracle Fusion Middleware Using Logging Services for Application Logging for Oracle WebLogic Server version=1.0 message messageid=FileMenuTitle messagebody Fichier messagebody message 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 installed with WebLogic Server is a tool that can be used to generate valid UTF-8 characters.

4.5.6 Elements of a Locale-Specific Catalog