Package org.jppf.utils
Class LocalizationUtils
java.lang.Object
org.jppf.utils.LocalizationUtils
Utility methods to localize messages in the JPPF components.
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetLocalisationBase(String base, String filename) Compute a localisation base path from a base folder and a file name.static StringgetLocalized(String baseName, String key) Get a localized property value.static String[]getLocalized(String baseName, String... keys) Get a localized array of property values.static StringgetLocalized(String baseName, String key, String def) Get a localized property value.static StringgetLocalized(String baseName, String key, String def, Locale locale) Get a localized property value for the specified locale.static StringGet a localized property value for the specified locale.static StringgetLocalized(String baseName, String key, Locale locale) Get a localized property value.static String[]getLocalized(String baseName, Locale locale, String... keys) Get a localized array of property values.
-
Constructor Details
-
LocalizationUtils
public LocalizationUtils()
-
-
Method Details
-
getLocalized
Get a localized property value.- Parameters:
baseName- the base name to use, in combination with the default locale, to lookup the appropriate resource bundle.key- the key for the localized value to lookup.- Returns:
- the name localized through the default locale information, or the key itself if it could not be localized.
-
getLocalized
Get a localized array of property values.- Parameters:
baseName- the base name to use, in combination with the default locale, to lookup the appropriate resource bundle.keys- the keys for which to lookup a localized value.- Returns:
- an array of localized values looked up using the default locale. If a key could not be localized, it is returned as the value.
-
getLocalized
Get a localized array of property values.- Parameters:
baseName- the base name to use, in combination with the default locale, to lookup the appropriate resource bundle.locale- the locale for which to lookup localized values.keys- the keys for which to lookup a localized value.- Returns:
- an array of localized values looked up using the default locale. If a key could not be localized, it is returned as the value.
-
getLocalized
Get a localized property value.- Parameters:
baseName- the base name to use, in combination with the default locale, to lookup the appropriate resource bundle.key- the key for the localized value to lookup.locale- the locale for which to lookup localized values.- Returns:
- the name localized through the default locale information, or the key itself if it could not be localized.
-
getLocalized
Get a localized property value.- Parameters:
baseName- the base name to use, in combination with the default locale, to lookup the appropriate resource bundle.key- the key for the localized value to lookup.def- the default value to return if no localized string could be found.- Returns:
- the name localized through the default locale information, or the key itself if it could not be localized.
-
getLocalized
Get a localized property value for the specified locale.- Parameters:
baseName- the base name to use, in combination with the default locale, to lookup the appropriate resource bundle.key- the key for the localized value to lookup.def- the default value to return if no localized string could be found.locale- the locale for which to lookup a localized value.- Returns:
- the name localized through the default locale information, or the key itself if it could not be localized.
-
getLocalized
public static String getLocalized(String baseName, String key, String def, Locale locale, Object... params) Get a localized property value for the specified locale.- Parameters:
baseName- the base name to use, in combination with the default locale, to lookup the appropriate resource bundle.key- the key for the localized value to lookup.def- the default value to return if no localized string could be found.locale- the locale for which to lookup a localized value.params- optional parameters for parametrized messages.- Returns:
- the name localized through the default locale information, or the key itself if it could not be localized.
-
getLocalisationBase
Compute a localisation base path from a base folder and a file name.- Parameters:
base- the base folder path as a string.filename- the filename from which to get the resource bundle name.- Returns:
- the complete path to a resource bundle.
-