steps to provide I18N Support in JSF Application

steps to provide I18N Support in JSF Application

 

  • Prepare properties files for each and every locale

To prepare properties files, we have to use the following naming convections for the properties file

<base-name>-<long>.properties

In the properties files, we have to provide locale respective messages in the form of key-value pairs, where keys should be in English and values should be in locale language

EX: abe-en. properties:-

Income = user name

Upwd= password

 

abc-it. properties

u name- user name

Upwd= password

  • Configure locale and properties file in faces configuration file

To configure locale and properties files in faces configuration file, we have to use the following tags

<faces-config>

---

<application>

<locale-config>

<default-locale>en</default-locale>

<supported-locale>it</ supported -locale>

</locale-config>

<resource-bundle>

<base-name>abe</base-name>

<var>msg</ var >

</resource-bundle>

</application>

----------

</faces-config>

  1. Access the message from properties file

To access the messages from properties file, we have to use the following <hi output text>gag

<h:output text value=”#{msg. uname}”/>

<h:output text value=”#{msg. upwd}”/>