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

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
Copy to Clipboard Toggle word wrap
And in messages_en_AU.properties:
Hello=G'day
Copy to Clipboard Toggle word wrap
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.
<core:resource-loader> 
  <core:bundle-names> 
    <value>mycompany_messages</value> 
    <value>standard_messages</value>       
  </core:bundle-names> 
</core:resource-loader>
Copy to Clipboard Toggle word wrap
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"/>
Copy to Clipboard Toggle word wrap
Then we could use messages defined in HelloMessages.properties on /welcome/hello.jsp.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat