Internationalization and Localization are the processes of adaptation of web applications for different languages and cultures. When a site is developed, the requirement may be to localize the site for United States of America, England, Germany, Japan, Chinese (Simplified/Traditional), etc. Language is not the only thing that undergoes the localization — dates, times, numbers, currencies, phone numbers, addresses, graphics, icons, colors, personal titles and even favorite sounds are also vary from country to country. It means that an internationalized application may have lots of different types of information, which is dynamic based on user location.

No surprise finding lot of articles on implementing the Internationalization in JSF/SEAM over surfing, but the crux which makes this article different from others is

Achieving internationalization by leveraging framework capabilities less coding effort, just configuration

Yes, We are going to implement Internationalization without any coding effort. No manual coding effort is required in terms of bean and processing locale’s.

There are several approaches of organizing the localization. You can use f:loadBundle – loads bundles into the request scope when page is being rendered / a4j:loadBundle – it allows to use reference to a particular bundle item during an Ajax update.

Steps to do

Step 1:
Define a locale configuration in faces-config.xml


Step 2:
Create various messages properties as per you need/requirement for each locale. Properties file name consists of two portion, prefix and suffix. As standard naming convention we will use “messages” as prefix and “locale string” as suffix. Of course file extension properties will be appended at the end.

For example:
Assume we are going to create two one holding product related messages & another holding user messages for US,UK,DE & JP.


Place all the message properties which you have created into resources directory “src/main/resources”
you can keep these message properties in classpath as well. Either way is fine!

Step 3:
Now we will create a .xhtml file utilizing the messages from the properties we have created above. Ensure XML namespace “xmlns:f=”” refered in the XHTML

Step 4:
Of course we will be placing this tag f:loadBundle in centralized file, something like header.xhtml/resources.xhtml.

Include tag in xhtml

<f:loadBundle basename="product_messages_#{localeSelector.localeString}" var="prodmsg" />
<f:loadBundle basename="user_messages_#{localeSelector.localeString}" var="usermsg" />

f:loadBundle dynamically loads the messages for different countries based on locale.


  • f:loadBundle tag – loads mentioned properties file from classpath
  • basename attribute- name of the properties file
  • localeSelector.localeString function – localeSelector is SEAM component, it provides the locale string via localeString attribute. For example: lets take locale as Japan. This method returns “ja_JP”, so basename gets fulfilled with “product_messages_ja_JP” and “user_messages_ja_JP”
  • var=”messages” – variable name for accessing key value

Step 5:
Let’s use the message bundle in the pages, we have full access to localization key values

Using Product Messages in HTML / JSF:

<div>${prodmsg['']} : </div>


<h:outputText value="#{prodmsg['']}" />

Using User Messages in HTML / JSF:




<h:outputText value="#{usermsg['label.user.welcomeGreetings']}" />


Now we are good to go, we have achieved successfully; the internationalization/localization in JSF/SEAM! without any coding effort!.