Java Reference
In-Depth Information
</resource-bundle>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>es</supported-locale>
<supported-locale>de</supported-locale>
<supported-locale>fr</supported-locale>
</locale-config>
</application>
This set of elements causes the application to be populated with the messages that are con-
tained in the specified resource bundle.
The
resource-bundle
element represents a set of localized messages. It must contain
the fully qualified path to the resource bundle containing the localized messages (in this
case,
dukestutoring.web.messages.Messages
). The
var
element defines the
EL name by which page authors refer to the resource bundle.
The
locale-config
element lists the default locale and the other supported locales.
The
locale-config
element enables the system to find the correct locale based on the
browser's language settings.
The
supported-locale
and
default-locale
tags accept the lowercase, two-
character codes defined by ISO 639 (see
http://ftp.ics.uci.edu/pub/ietf/
http/related/iso639.txt
)
. Make sure your resource bundle actually contains the
messages for the locales you specify with these tags.
To access the localized message, the application developer merely references the key of
the message from the resource bundle.
You can pull localized text into an
alt
tag for a graphic image, as in the following ex-
ample:
<h:graphicImage id="mapImage"
name="book_all.jpg"
library="images"
alt="#{bundle.ChooseBook}"
usemap="#bookMap" />
The
alt
attribute can accept value expressions. In this case, the
alt
attribute refers to
localized text that will be included in the alternative text of the image rendered by this tag.