public class Locales extends Object
Constructor and Description |
---|
Locales() |
Modifier and Type | Method and Description |
---|---|
static Locale |
parseLocale(String localeValue)
Parse the given
String value into a Locale , accepting
the Locale.toString() format as well as BCP 47 language tags and
Win32 verbose locale names. |
public static Locale parseLocale(String localeValue)
String
value into a Locale
, accepting
the Locale.toString()
format as well as BCP 47 language tags and
Win32 verbose locale names. If the locale may include an encoding
(e.g. UTF-8) or codepage (e.g. 1252) following a '.', it will be stripped.
"C" & "POSIX" locales are always mapped to Locale.ROOT
localeValue
- the locale value: following either Locale's
toString()
format ("en", "en_UK", etc), or BCP 47 (e.g. "en-UK")
as specified by Locale.forLanguageTag(java.lang.String)
on Java 7+, or Win32 verbose
locale names (e.g. "English_United States"). Optionally including an ignored
encoding or Win32 codepage.Locale
instance, or null
if noneIllegalArgumentException
- in case of an invalid locale specification