-
- All Implemented Interfaces:
public class LocaleHelper
-
-
Field Summary
Fields Modifier and Type Field Description public final static LocaleHelperINSTANCE
-
Method Summary
Modifier and Type Method Description final Booleanany(Set<String> locales, String locale)Search locale in List final StringanyMatch(Set<String> locales, Map<String, String> defaultCountries, Map<String, String> fallbackCodes, Locale defaultLocale)Get match locale final LocalebuildLocale(String language)Build locale from string (e. final Booleanmatches(String locale1, String locale2)Compare locale strings final StringremoveCountryCode(String locale)Remove country code. -
-
Method Detail
-
any
final Boolean any(Set<String> locales, String locale)
Search locale in List
- Parameters:
locales- locale list as Setlocale- locale string to search
-
anyMatch
final String anyMatch(Set<String> locales, Map<String, String> defaultCountries, Map<String, String> fallbackCodes, Locale defaultLocale)
Get match locale
- Parameters:
locales- locale list as SetdefaultCountries- default countries listfallbackCodes- fallback language codes.defaultLocale- the default Locale from device
-
buildLocale
final Locale buildLocale(String language)
Build locale from string (e.g "fr", "fr-FR", "fr_FR")
-
matches
final Boolean matches(String locale1, String locale2)
Compare locale strings
- Parameters:
locale1- string to comparelocale2- string to compare
-
removeCountryCode
final String removeCountryCode(String locale)
Remove country code. Required for backwards compatibility.
-
-
-
-