JSTL I18N Overview 

Joined:
08/13/2009
Posts:
110

July 27, 2010 16:42:08    Last update: July 30, 2010 18:39:48
Three key concepts are associated with internationalization (I18N):
  1. Locale: a locale is identified by a language code along with an optional country code. For example: en for English, en_US for US English, zh_CN for simplified Chinese.
  2. Resource Bundle: a resource bundle is a properties file localized for a specific locale. For example, messages_en.properties may be a resource bundle for English, messages_zh.properties may be a resource bundle for Chinese.
  3. Basename: a basename identifies the same set of messages represented by all related resource bundles. In the above example, the basename is messages.


When a user request comes to a web application, the resource bundle is retrieved using the basename and the preferred locales. The preferred locale can be either application-based or browser-based. When the locale is set by the application, it takes precedence over browser based locale setting.

Given an ordered set of preferred locales, the resource bundle is searched in this order for each locale in turn:
  1. basename_language_country_variant
  2. basename_language_country
  3. basename_language


A fallback locale may be defined for JSTL. If no resource bundle is found with the above algorithm, the fallback resource bundle is used.

Share |
| Comment  | Tags