A {@code I18NBundle} provides {@code Locale}-specific resources loaded from property files. A bundle contains a number of named resources, whose names and values are {@code Strings}. A bundle may have a parent bundle, and when a resource is not found in a bundle, the parent bundle is searched for the resource. If the fallback mechanism reaches the base bundle and still can't find the resource it throws a {@code MissingResourceException}.
- All bundles for the same group of resources share a common base bundle. This base bundle acts as the root and is the last fallback in case none of its children was able to respond to a request.
- The first level contains changes between different languages. Only the differences between a language and the language of the base bundle need to be handled by a language-specific {@code I18NBundle}.
- The second level contains changes between different countries that use the same language. Only the differences between a country and the country of the language bundle need to be handled by a country-specific {@code I18NBundle}.
- The third level contains changes that don't have a geographic reason (e.g. changes that where made at some point in time like {@code PREEURO} where the currency of come countries changed. The country bundle would return the current currency (Euro)and the {@code PREEURO} variant bundle would return the old currency (e.g. DM for Germany).
Examples - BaseName (base bundle)
- BaseName_de (german language bundle)
- BaseName_fr (french language bundle)
- BaseName_de_DE (bundle with Germany specific resources in german)
- BaseName_de_CH (bundle with Switzerland specific resources in german)
- BaseName_fr_CH (bundle with Switzerland specific resources in french)
- BaseName_de_DE_PREEURO (bundle with Germany specific resources in german of the time before the Euro)
- BaseName_fr_FR_PREEURO (bundle with France specific resources in french of the time before the Euro)
It's also possible to create variants for languages or countries. This can be done by just skipping the country or language abbreviation: BaseName_us__POSIX or BaseName__DE_PREEURO. But it's not allowed to circumvent both language and country: BaseName___VARIANT is illegal.
@see PropertiesUtils
@author davebaol