![]() |
|||||
|
Chapter 5. Configuring locales for openCRX with web.xmlConfiguring locales for openCRX is done by modifying the file web.xml in the directory C:\temp\opencrx-core-CRX.war\WEB-INF. If you open the file web.xml you will find the following section: Example 5-1. web.xml containing locale configuration information . <!-- locales --> <init-param> <param-name>locale[0]</param-name> <param-value>en_US</param-value> </init-param> <init-param> <param-name>locale[1]</param-name> <param-value>de_CH</param-value> </init-param> . To configure an additional locale for openCRX you need to add a new locale-block. For example, to add the locale xx_YY you modify web.xml as follows: Example 5-2. web.xml containing locale configuration information for en_US, de_CH, and the new locale xx_YY .
<!-- locales -->
<init-param>
<param-name>locale[0]</param-name>
<param-value>en_US</param-value>
</init-param>
<init-param>
<param-name>locale[1]</param-name>
<param-value>de_CH</param-value>
</init-param>
<init-param>
<param-name>locale[2]</param-name>
<param-value>xx_YY</param-value>
</init-param>
.
Fallback MechanismThe following rules apply for missing localization information (it is assumed that the locale is xx_YY): user interface configuration if no entry is found for the respective label/toolTip, then the existing entry of the locale xx_ZZ (i.e. same language as xx_YY) with the highest index number (see Configuring locales for openCRX with web.xml) is taken. if no entry is found with the same language xx, then the entry of the default locale (i.e. the locale with index number "0", usually en_US) is taken. code tables if no entry is found for the respective code, then the existing entry of the locale xx_ZZ (i.e. same language as xx_YY) with the highest index number (see Configuring locales for openCRX with web.xml) is taken. if no entry is found with the same language xx, then the entry of the default locale (i.e. the locale with index number "0", usually en_US) is taken. opencrx.texts.properties and texts.properties if no entry is found for the respective name, then the existing entry of the locale xx_ZZ (i.e. same language as xx_YY) with the highest index number (see Configuring locales for openCRX with web.xml) is taken. if no entry is found with the same language xx, then the entry of the default locale (i.e. the locale with index number "0", usually en_US) is taken. html help pages there is no fallback mechanism - if a page is missing for a requested locale the user will get an error 404 (page not found) login.jsp there is no fallback mechanism - login.jsp is a special case anyway (see modify Login.jsp) The following description explains the implemented locale fallback mechanism of openCRX in a somewhat more formal way (only applies to user interface configuration, code tables, and text.properties). Please note that the locale fallback is based on language xx and not on a fully qualified locale string xx_YY:
Example: If e.g. the locales en_US (locale[0]), de_CH (locale[1]) and de_DE (locale[2]) are configured and no resources are available for de_DE then de_DE falls back to de_CH. |
||||
![]() | ![]() |