Java Platform Localization Classes
In the Java platform, java.util.Locale (http://docs.oracle.com/javase/6/docs/api/java/util/Locale.html) represents a specific geographical, political, or cultural region. The string representation of a locale consists of the international standard two-character abbreviation for language and country and an optional variant, separated by underscore (_) characters. Examples of locale strings include fr (French), de_CH (Swiss German), and en_US_POSIX (English on a POSIX-compliant platform).
Locale-sensitive data is stored in a java.util.ResourceBundle (http://docs.oracle.com/javase/6/docs/api/java/util/ResourceBundle.html). A resource bundle contains key-value pairs, where the key uniquely identifies a locale-specific object in the bundle. A resource bundle can be backed by a text file (properties resource bundle) or a class (list resource bundle) containing the pairs. You construct a resource bundle instance by appending a locale string representation to a base name.
The Duke’s Tutoring application contains resource bundles with the base name messages.properties for the locales pt (Portuguese), de (German), es (Spanish), and zh (Chinese). The default locale, en (English), which is specified in the faces-config.xml file, uses the resource bundle with the base name, messages.properties.