public class LocaleHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static LocaleHelper |
createIfPresent(Jar jar,
Locale locale,
String basePath)
Create a
LocaleHelper if localization data are found at the
specified path, otherwise return null. |
static LocaleHelper |
empty() |
String |
get(String variableOrValue)
If the argument is a variable, its corresponding value will be returned
for the default locale of this helper instance.
|
String |
get(String variableOrValue,
Locale locale)
If the argument is a variable, its corresponding value will be returned
for the specified locale.
|
public static LocaleHelper createIfPresent(Jar jar, Locale locale, String basePath)
LocaleHelper if localization data are found at the
specified path, otherwise return null.jar - the jar containing the localization file, must not be
nulllocale - the default locale for this helper, must not be
nullbasePath - a base path in the Jar to the localization property files
without its extension and its locale suffix, must not be
nullLocaleHelper which contains localization data or
null if there is no localization data at the specified
path.public static LocaleHelper empty()
LocaleHelper without localization data, never
nullpublic String get(String variableOrValue)
Values will be search from the most specific to the less specific locale including unlocalized (empty locale) value.
variableOrValue - a variable (starting with '%') or a value, can be
nullnullpublic String get(String variableOrValue, Locale locale)
Values will be search from the most specific to the less specific locale including unlocalized (empty locale) value.
variableOrValue - a variable (starting with '%') or a value, can be
nulllocale - the locale, must not be nullnullCopyright © 2021. All rights reserved.