Class LocaleUtil


  • public abstract class LocaleUtil
    extends java.lang.Object
    Utility class for locale handling.
    • Constructor Summary

      Constructors 
      Constructor Description
      LocaleUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Locale parseLocale​(java.lang.String text)
      Parses the given text to create its corresponding Locale.
      static java.lang.String toRFC4646​(java.util.Locale locale)
      Converts the given locale to RFC 4646 format.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocaleUtil

        public LocaleUtil()
    • Method Detail

      • parseLocale

        public static java.util.Locale parseLocale​(java.lang.String text)
        Parses the given text to create its corresponding Locale. This method supports "-" and "_" as locale element separator.
        Parameters:
        text - string to parse
        Returns:
        the Locale
      • toRFC4646

        public static java.lang.String toRFC4646​(java.util.Locale locale)
        Converts the given locale to RFC 4646 format. e.g. "en_US" to "en-US".
        Parameters:
        locale - the Locale to convert to RFC 4646 format
        Returns:
        the string in RFC 4646 format corresponding to the submitted Locale