Class LocaleUtils


  • public class LocaleUtils
    extends org.apache.commons.lang3.LocaleUtils
    Extends LocaleUtils with more tools.
    Since:
    5.1RC1
    Version:
    $Id: f41368dd83ab79f2b0d1e9d915aaa75ddf5538fb $
    • Constructor Detail

      • LocaleUtils

        public LocaleUtils()
    • Method Detail

      • getParentLocale

        public static Locale getParentLocale​(Locale locale)
        Parameters:
        locale - the locale
        Returns:
        the parent locale
      • toLocale

        public static Locale toLocale​(String str)
        Extends LocaleUtils which return Locale.ROOT for an empty string.
        Parameters:
        str - the locale String to convert, null returns null
        Returns:
        a Locale, null if null input
        Throws:
        IllegalArgumentException - if the string is an invalid format
        Since:
        5.2M1
      • toLocale

        public static Locale toLocale​(String str,
                                      Locale fallback)
        Same as toLocale(String) but it never throws an exception. It returns the passed fallback locale in case the given string locale has an invalid format.
        Parameters:
        str - the locale string to convert, null returns null
        fallback - the locale to return as fallback in case the given locale string has an invalid format
        Returns:
        a Locale, null if null input
        Since:
        6.0M1
        See Also:
        toLocale(String)