public interface ResourceBundle
ResourceBundle
is a set of Strings identified by keys
A ResourceBundle
is associated with a Locale
making the Strings specific for that Locale
.
ResourceBundle
s can be obtained by name from the LocalizationService
.
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.
See LocalizationService
for an exact description.Modifier and Type | Method and Description |
---|---|
Locale |
getLocale()
The
Locale of this ResourceBundle . |
String |
getName()
The name of this
ResourceBundle . |
String |
getString(String key)
Gets the
Locale -specific translation identified by a given key . |
default String |
getString(String key,
Map<String,String> parameters)
Gets the
Locale -specific translation identified by a given key . |
default String |
getString(String key,
String parameterName,
String parameterValue)
Gets the
Locale -specific translation identified by a given key . |
default ResourceBundle |
toJavaResourceBundle() |
Locale getLocale()
Locale
of this ResourceBundle
.String getName()
ResourceBundle
.String getString(String key)
Locale
-specific translation identified by a given key
.
If a String is not defined in this bundle the call is forwarded
to the parent bundle.key
- a key
identifying a Stringkey
default String getString(String key, Map<String,String> parameters)
Locale
-specific translation identified by a given key
. 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 use getString(String, String,
String)
.key
- a key
identifying a Stringparameters
- a map of names and values to replace variableskey
with replaced variablesdefault String getString(String key, String parameterName, String parameterValue)
Locale
-specific translation identified by a given key
. 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 use getString(String, Map)
.key
- a key
identifying a StringparameterName
- the name of the variable as defined in the StringparameterValue
- the replacement value for the variablekey
with replaced variablesdefault ResourceBundle toJavaResourceBundle()
Copyright © 2007–2019 Hippo B.V. (http://www.onehippo.com). All rights reserved.