Package org.onehippo.repository.l10n
Interface ResourceBundle
-
public interface ResourceBundle
AResourceBundle
is a set of Strings identified by keys AResourceBundle
is associated with aLocale
making the Strings specific for thatLocale
.ResourceBundle
s can be obtained by name from theLocalizationService
.ResourceBundle
s are ordered in a fallback hierarchy. If a String is not defined in the current bundle the call is forwarded to the parent bundle. SeeLocalizationService
for an exact description.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Locale
getLocale()
TheLocale
of thisResourceBundle
.String
getName()
The name of thisResourceBundle
.String
getString(String key)
Gets theLocale
-specific translation identified by a givenkey
.default String
getString(String key, String parameterName, String parameterValue)
Gets theLocale
-specific translation identified by a givenkey
.default String
getString(String key, Map<String,String> parameters)
Gets theLocale
-specific translation identified by a givenkey
.default ResourceBundle
toJavaResourceBundle()
-
-
-
Method Detail
-
getLocale
Locale getLocale()
TheLocale
of thisResourceBundle
.
-
getName
String getName()
The name of thisResourceBundle
.
-
getString
String getString(String key)
Gets theLocale
-specific translation identified by a givenkey
. If a String is not defined in this bundle the call is forwarded to the parent bundle.- Parameters:
key
- akey
identifying a String- Returns:
- the String identified by a
key
-
getString
default String getString(String key, Map<String,String> parameters)
Gets theLocale
-specific translation identified by a givenkey
. If a String is not defined in this bundle the call is forwarded to the parent bundle. Variables in the Strings can be replaced by supplying parameters. The default definition of a variable is${variableName}
. If the label has only one variable usegetString(String, String, String)
.- Parameters:
key
- akey
identifying a Stringparameters
- a map of names and values to replace variables- Returns:
- the String identified by a
key
with replaced variables
-
getString
default String getString(String key, String parameterName, String parameterValue)
Gets theLocale
-specific translation identified by a givenkey
. If a String is not defined in this bundle the call is forwarded to the parent bundle. One variable in the String can be replaced by the parameterName and parameterValue. The default definition of a variable is${variableName}
. Convenience method for Strings with only one variable. If there are multiple variables usegetString(String, Map)
.- Parameters:
key
- akey
identifying a StringparameterName
- the name of the variable as defined in the StringparameterValue
- the replacement value for the variable- Returns:
- the String identified by a
key
with replaced variables
-
toJavaResourceBundle
default ResourceBundle toJavaResourceBundle()
-
-