Class Locales


  • public class Locales
    extends Object
    • Constructor Detail

      • Locales

        public Locales()
    • Method Detail

      • parseLocale

        public 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. 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
        Parameters:
        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.
        Returns:
        a corresponding Locale instance, or null if none
        Throws:
        IllegalArgumentException - in case of an invalid locale specification