Package com.impossibl.postgres.utils
Class Locales
- java.lang.Object
-
- com.impossibl.postgres.utils.Locales
-
public class Locales extends Object
-
-
Constructor Summary
Constructors Constructor Description Locales()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Locale
parseLocale(String localeValue)
Parse the givenString
value into aLocale
, accepting theLocale.toString()
format as well as BCP 47 language tags and Win32 verbose locale names.
-
-
-
Method Detail
-
parseLocale
public static Locale parseLocale(String localeValue)
Parse the givenString
value into aLocale
, accepting theLocale.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 toLocale.ROOT
- Parameters:
localeValue
- the locale value: following eitherLocale's
toString()
format ("en", "en_UK", etc), or BCP 47 (e.g. "en-UK") as specified byLocale.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.- Returns:
- a corresponding
Locale
instance, ornull
if none - Throws:
IllegalArgumentException
- in case of an invalid locale specification
-
-