Class Locales


  • public class Locales
    extends java.lang.Object
    Functions for working with Locales.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] SUPPORTED_LANGUAGE_TAGS
      The list of locale resource bundles.
      static java.util.List<java.util.Locale> SUPPORTED_LOCALES
      The supported locales.
    • Constructor Summary

      Constructors 
      Constructor Description
      Locales()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Locale findSupported​(java.lang.String priorityList)
      Determine the best matching Locale with respect to the priority list.
      static java.util.Locale findSupported​(java.lang.String priorityList, java.util.Collection<java.util.Locale> locales)
      Determine the best matching Locale with respect to the priority list.
      static java.util.Locale findSupported​(java.util.List<java.util.Locale.LanguageRange> priorityList, java.util.Collection<java.util.Locale> locales, java.util.Locale.FilteringMode filteringMode)
      Determine the best matching Locale with respect to the priority list.
      static java.util.List<java.util.Locale> getSupportedLocales()
      Gets the supported locales.
      static java.util.List<java.util.Locale> of​(java.lang.String... languageTags)
      Gets a list of Locale by language tags.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SUPPORTED_LANGUAGE_TAGS

        public static final java.lang.String[] SUPPORTED_LANGUAGE_TAGS
        The list of locale resource bundles.
      • SUPPORTED_LOCALES

        public static final java.util.List<java.util.Locale> SUPPORTED_LOCALES
        The supported locales.
    • Constructor Detail

      • Locales

        public Locales()
    • Method Detail

      • getSupportedLocales

        public static java.util.List<java.util.Locale> getSupportedLocales()
        Gets the supported locales.
        Returns:
        the supported locales
      • of

        public static java.util.List<java.util.Locale> of​(java.lang.String... languageTags)
        Gets a list of Locale by language tags.
        Parameters:
        languageTags - for the locales
        Returns:
        the locales
      • findSupported

        public static java.util.Locale findSupported​(java.lang.String priorityList)
        Determine the best matching Locale with respect to the priority list.
        Parameters:
        priorityList - the language tag priority list
        Returns:
        the best matching locale
      • findSupported

        public static java.util.Locale findSupported​(java.lang.String priorityList,
                                                     java.util.Collection<java.util.Locale> locales)
        Determine the best matching Locale with respect to the priority list.
        Parameters:
        priorityList - the language tag priority list
        locales - the supported locales
        Returns:
        the best matching locale
      • findSupported

        public static java.util.Locale findSupported​(java.util.List<java.util.Locale.LanguageRange> priorityList,
                                                     java.util.Collection<java.util.Locale> locales,
                                                     java.util.Locale.FilteringMode filteringMode)
        Determine the best matching Locale with respect to the priority list.
        Parameters:
        priorityList - the language tag priority list
        locales - the supported locales
        filteringMode - the filtering mode
        Returns:
        the best matching locale