Interface LocalizationService


public interface LocalizationService

A service for obtaining ResourceBundles from the repository. The ResourceBundles are located at /hippo:configuration/hippo:translations. ResourceBundles are identified by a combination of a name and a Locale.

ResourceBundle resolution is implemented as follows. A Locale is interpreted to have three levels of identity, which from least to most specific are: language, country, and variant. These may not all be specified, only the least specific locale identifier, the language is mandatory. When a ResourceBundle is requested from the service, first an exact match is attempted, i.e. a ResourceBundle is searched that matches the full identity of the given Locale. If an exact match is not found a less exact match is attempted.

For example, if the ResourceBundle for the Locale th_TH_TH is requested, first an exact match is attempted, if no such ResourceBundle exists one less specific ResourceBundle is searched, i.e. th_TH, and if that also does not yield a result, the ResourceBundle for the th locale is looked up. Finally, if still no ResourceBundle is found, a ResourceBundle with that name for the DEFAULT_LOCALE is returned if one exists.

In the same way, according to the same criteria of decreasing specificity of identity, ResourceBundles are linked in a fallback hierarchy: If the ResourceBundle matching the exact identity of th_TH_TH does not yield a result for a specific ResourceBundle.getString(String), the implementation falls back on a match higher up in the hierarchy: first the ResourceBundle for th_TH is attempted (if it exists) all the way up to the default bundle.