public class LocaleUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static char |
HYPHEN |
private static char |
UNDERSCORE |
| Constructor and Description |
|---|
LocaleUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Locale |
parseLocale(java.lang.String locale)
See parseLocale(String, String) for details.
|
static java.util.Locale |
parseLocale(java.lang.String locale,
java.lang.String variant)
Parses the given locale string into its language and (optionally)
country components, and returns the corresponding
Locale object. |
static java.util.Locale |
parseLocaleAttributeValue(java.lang.Object stringOrLocale)
Handles Locales that can be passed to tags as instances of String or Locale.
|
private static final char HYPHEN
private static final char UNDERSCORE
public static java.util.Locale parseLocaleAttributeValue(java.lang.Object stringOrLocale)
parseLocale(String).
Otherwise null will be returned.stringOrLocale - locale represented as an instance of Locale or as a Stringpublic static java.util.Locale parseLocale(java.lang.String locale)
public static java.util.Locale parseLocale(java.lang.String locale,
java.lang.String variant)
Locale object.locale - the locale string to parse; must not be null or emptyvariant - the variantjava.lang.IllegalArgumentException - if the given locale does not have a
language component or has an empty country component