public interface LocalizationService
A service for obtaining
ResourceBundles from the repository.
ResourceBundles are located at /hippo:configuration/hippo:translations.
ResourceBundles are identified by a combination of a name and a
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.
ResourceBundle is requested from the service, first an exact match is attempted, i.e.
ResourceBundle is searched that matches the full identity of the given
If an exact match is not found a less exact match is attempted.
For example, if the
th_TH_TH is requested, first an exact match is attempted, if no such
ResourceBundle exists one less specific
ResourceBundle is searched, i.e.
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,
are linked in a fallback hierarchy: If the
ResourceBundle matching the exact identity of
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
th_TH is attempted (if it exists)
all the way up to the default bundle.
|Modifier and Type||Field and Description|
The root path in the repository where
static final String TRANSLATIONS_PATH
ResourceBundles are stored.
static final Locale DEFAULT_LOCALE
ResourceBundle getResourceBundle(String name, Locale locale)
ResourceBundlefrom the repository by name and
Locale. The name of a resource bundle is path relative to the
TRANSLATIONS_PATHwhere the path elements are separated by periods (".") instead of forward slashes. A
Localeobject identifies the
ResourceBundleamong the bundles identified by same path. If the
ResourceBundlefor the requested locale is not available the implementation tries to return the
ResourceBundlefor the default
Localeidentified by the same name.
Copyright © 2007–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.