Enum LocaleMatcher.Direction

  • All Implemented Interfaces:
    Serializable, Comparable<LocaleMatcher.Direction>
    Enclosing class:
    LocaleMatcher

    public static enum LocaleMatcher.Direction
    extends Enum<LocaleMatcher.Direction>
    Builder option for whether to include or ignore one-way (fallback) match data. The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. Sometimes it is desirable to ignore those.

    For example, consider a web application with the UI in a given language, with a link to another, related web app. The link should include the UI language, and the target server may also use the client’s Accept-Language header data. The target server has its own list of supported languages. One may want to favor UI language consistency, that is, if there is a decent match for the original UI language, we want to use it, but not if it is merely a fallback.

    See Also:
    LocaleMatcher.Builder.setDirection(LocaleMatcher.Direction)
    Status:
    Stable ICU 67.
    • Enum Constant Detail

      • WITH_ONE_WAY

        public static final LocaleMatcher.Direction WITH_ONE_WAY
        Locale matching includes one-way matches such as Breton→French. (default)
        Status:
        Stable ICU 67.
      • ONLY_TWO_WAY

        public static final LocaleMatcher.Direction ONLY_TWO_WAY
        Locale matching limited to two-way matches including e.g. Danish↔Norwegian but ignoring one-way matches.
        Status:
        Stable ICU 67.
    • Method Detail

      • values

        public static LocaleMatcher.Direction[] 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.Direction c : LocaleMatcher.Direction.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.Direction 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