Ce contenu n'est pas disponible dans la langue sélectionnée.
16.3. Labels
JSF supports the internationalization of user interface labels and descriptive text with the
<f:loadBundle />. In Seam applications, you can either take this approach, or use the Seam messages component to display templated labels with embedded EL expressions.
16.3.1. Defining labels Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
Make your internationalized labels available with Seam's
java.util.ResourceBundle, available to the application as a org.jboss.seam.core.resourceBundle. By default, Seam uses a resource bundle named messages, so you will need to define your labels in files named messages.properties, messages_en.properties, messages_en_AU.properties, etc. These files usually belong in the WEB-INF/classes directory.
So, in
messages_en.properties:
Hello=Hello
Hello=Hello
And in
messages_en_AU.properties:
Hello=G'day
Hello=G'day
You can select a different name for the resource bundle by setting the Seam configuration property named
org.jboss.seam.core.resourceLoader.bundleNames. You can even specify a list of resource bundle names to be searched (depth first) for messages.
To define a message for one particular page, specify it in a resource bundle with the same name as the JSF view ID, with the leading
/ and trailing file extension removed. So, we could put our message in welcome/hello_en.properties if we only needed to display the message on /welcome/hello.jsp.
You can even specify an explicit bundle name in
pages.xml:
<page view-id="/welcome/hello.jsp" bundle="HelloMessages"/>
<page view-id="/welcome/hello.jsp" bundle="HelloMessages"/>
Then we could use messages defined in
HelloMessages.properties on /welcome/hello.jsp.