Enum LocaleMatcher.Direction

java.lang.Object
java.lang.Enum<LocaleMatcher.Direction>
com.ibm.icu.util.LocaleMatcher.Direction
All Implemented Interfaces:
Serializable, Comparable<LocaleMatcher.Direction>, java.lang.constant.Constable
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:
  • Enum Constant Details

    • WITH_ONE_WAY

      public static final LocaleMatcher.Direction WITH_ONE_WAY
      Locale matching includes one-way matches such as Breton→French. (default)
    • 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.
  • Method Details

    • values

      public static LocaleMatcher.Direction[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      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