Customise the User Interface Language Based on Country
In most cases, you will only need to create a single version of each properties file for each language.
However, if you need to support languages with regional differences, such as US and Australian English, or Canadian and French French, then you can optionally create additional properties files to cover the differences between language variants.
To enable this additional level of specialisation, you need to create additional properties files that include an upper-case, 2 character ISO 3166 country code in the filename, in addition to the language code. See http://www.iso.org/iso/prods-services/iso3166ma/02iso-3166-code-lists/country_names_and_code_elements for a list of acceptable codes.
For example, to support US and Australian English, you would create properties files named like the following:
- messages_en.properties
- messages_en_AU.properties
- messages_en_US.properties
To support Canadian and French French, you would create properties files named like the following:
- messages_fr.properties
- messages_fr_CA.properties
- messages_fr_FR.properties
If you choose to use this level of specialisation, then your country-specific files only need to include the properties with different values to the ones in the main properties file for that language. If a property is not defined in the country-specific properties file, then SuperWEB2 will automatically use the value of the property from the main language file.
For example, if you do not define a value for page.login.window.title
in messages_en_AU.properties, then SuperWEB2 will automatically use the value of page.login.window.title
that is defined in messages_en.properties.
For ease of maintenance it is better not to include definitions for properties in the country-specific file if they are identical to the ones in the main language file.
Once you have created the country-specific properties files, you must also add the country-specific locales to the <supported-locale>
list in <tomcat_home>\webapps\webapi\WEB-INF\faces-config.xml.
Make sure that the country-specific locales appear before the generic language locale in the <supported-locale>
list. If the generic language locale appears first then it will always be used instead of the country-specific locale.
For example:
<locale-config>
<default-locale>en</default-locale>
<supported-locale>de</supported-locale>
<supported-locale>fr_FR</supported-locale>
<supported-locale>fr_CA</supported-locale>
<supported-locale>fr</supported-locale>
<supported-locale>en_AU</supported-locale>
<supported-locale>en_US</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
Once you have finished making changes to faces-config.xml you must restart Tomcat or the SuperWEB2 service.