Enum LocaleMatcher.Demotion

    • Enum Constant Detail

      • NONE

        public static final LocaleMatcher.Demotion NONE
        All desired locales are treated equally.
        Status:
        Stable ICU 65.
      • REGION

        public static final LocaleMatcher.Demotion REGION
        Earlier desired locales are preferred.

        From each desired locale to the next, the distance to any supported locale is increased by an additional amount which is at least as large as most region mismatches. A later desired locale has to have a better match with some supported locale due to more than merely having the same region subtag.

        For example: Supported={en, sv} desired=[en-GB, sv] yields Result(en-GB, en) because with the demotion of sv its perfect match is no better than the region distance between the earlier desired locale en-GB and en=en-US.

        Notes:

        • In some cases, language and/or script differences can be as small as the typical region difference. (Example: sr-Latn vs. sr-Cyrl)
        • It is possible for certain region differences to be larger than usual, and larger than the demotion. (As of CLDR 35 there is no such case, but this is possible in future versions of the data.)
        Status:
        Stable ICU 65.
    • Method Detail

      • values

        public static LocaleMatcher.Demotion[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (LocaleMatcher.Demotion c : LocaleMatcher.Demotion.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static LocaleMatcher.Demotion valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null