ji18n Tag Library Documentation
Library Version: 1.0 A library of internationalization tags.
Library Description
A library of JSP tags for internationalized messages, URLs and templates. Technical Note: For more detailed information, consult the section on Internationalization in the Java Developers Guide. Tag Details<ji18n:message> Tag
Tag Handler Class:
This tag is used to generate internationalized messages in JSP pages
from data in configuration files. The tag specifies a lookup name and
the location of a resource property file. The message lookup process follows
a pattern similar to that used by Java's <ji18n:message name="message1" /> Messages are defined in the /WEB-INF/classes/page_config/chrysalis.xml configuration file. See the Page Configuration documentation for further details. In addition to the normal configuration files, you explicitly define the location of a particular message file, with the "resource" attribute. The message files can use Java's properties file format. <ji18n:message name="message1" resource="message_file" /> # In file "message_file.properties" message1=This is message one. message2=And here is message two. Message properties files are loaded via the Java classpath. The simplest place to put the message files is beneath the /WEB-INF/classes/ directory. If the resource name includes directory information, the message file must be in a subdirectory. <ji18n:message name="message1" resource="directory/message_file" /> [Located at "/WEB-INF/classes/directory/message_file.properties"] Message properties files for different languages need to have a "locale suffix" added to their name. These suffixes are derived from the ISO standard two-letter language codes. For example, the suffix for French is "_fr". # In file "message_file_fr.properties" message1=C'est message un. message2=Et ceci est message deux. Messages may include argument insertion points marked by # In the message resource properties file: message.with.arguments=Two values are inserted: {0} and {1}. Values for the insertion points may be specified using
<ji18n:message name="message.with.arguments"> <jutil:param name="value1">Value 1</jutil:param> <jutil:param name="value2">Value 2</jutil:param> </ji18n:message> [Results in "Two values are inserted: Value 1 and Value 2."] The parameter names are unimportant, but the order of the parameters must
match the numerical order of the insertion points. The first parameter is
inserted for
Technical Note: This tag uses the same search algorithm defined for
the Tag Attributes
<ji18n:resource> Tag
Tag Handler Class:
This tag specifies the resource file for all the following message
tags in the page. It is equivalent to setting the <ji18n:resource basename="message_file" /> Tag Attributes
<ji18n:include> Tag
Tag Handler Class:
This tag is similar to the Tag Attributes
<ji18n:includeBody> Tag
Tag Handler Class:
This tag is used in template pages to indicate the insertion point for the main page body. When this tag is encountered, processing is forwarded to the main JSP, whose output is inserted in the template. For example:
<ji18n:url> Tag
Tag Handler Class:
This tag generates a localized URL. It performs the following transformation on the URL value:
To localize by language, use the value <ji18n:url value="/images/logo.gif" i18n="LANGUAGE" /> In the above example, the URL will be:
To localize by language, use the value <ji18n:url value="/images/logo.gif" i18n="COUNTRY" /> In the above example, the URL will be:
If there is no <ji18n:url value="/images/logo.gif" />
Tag Attributes
|