public class LocaleUtil extends Object
| Constructor and Description |
|---|
LocaleUtil() |
| Modifier and Type | Method and Description |
|---|---|
static TextValue |
findClosestLocale(Collection<TextValue> textValues,
Locale localeToMatch)
Return the textValue whose language is closest the localeToMatch.
|
static TextValue |
findClosestLocale(Collection<TextValue> textValues,
Locale localeToMatch,
Locale defaultLocale)
Return the textValue whose language is closest the localeToMatch.
|
static Locale |
findClosestLocale(Set<Locale> locales,
Locale localeToMatch) |
static Locale |
findClosestLocale(Set<Locale> locales,
Locale localeToMatch,
Locale defaultLocale) |
static Locale |
getSimpleLocale(String languageString)
Parse the given languageString (e.g., "en-us", "en-US", "en_us", "en_US") and create a Locale from it.
|
public static TextValue findClosestLocale(Collection<TextValue> textValues, Locale localeToMatch)
textValues - - Collection of TextValues, each with a value and a language.localeToMatch - - Preferred locale to match against.public static TextValue findClosestLocale(Collection<TextValue> textValues, Locale localeToMatch, Locale defaultLocale)
textValues - - Collection of TextValues, each with a value and a language.localeToMatch - - Preferred locale to match against.defaultLocale - - Default locale to match against, if none are close to the preferred locale.public static Locale findClosestLocale(Set<Locale> locales, Locale localeToMatch, Locale defaultLocale)
public static Locale getSimpleLocale(String languageString)
languageString - - BCP47 or Java language string ("en", "en-us", "en_US", etc.)Copyright © 2016. All rights reserved.