Enum LanguageRangeEquivalents

java.lang.Object
java.lang.Enum<LanguageRangeEquivalents>
com.lokalized.LanguageRangeEquivalents
All Implemented Interfaces:
Serializable, Comparable<LanguageRangeEquivalents>, Constable

Controls where Lokalized takes IANA language-range equivalences from when it parses language ranges, such as the he/iw pair that makes a request for either language also consider the other.

The source decides which equivalent ranges LocaleMatcher.parseLanguageRanges(String) and LocaleMatcher.bestMatchForAcceptLanguage(String) add, and which ranges locale matching treats as equivalent, so it can change which loaded locale a request selects. Configure it with Strings.Builder.languageRangeEquivalents(LanguageRangeEquivalents).

Since:
3.1.0
Author:
Mark Allen
  • Enum Constant Details

    • IANA_REGISTRY

      Use the IANA Language Subtag Registry snapshot bundled in Lokalized: File-Date: 2026-09-17, SHA-256 755fad43283be7b41ebe3c89ad054b6eaf928f404f9c0edb74799e0eab74beb1.

      The equivalents it supplies are identical on every JDK. This is the default.

    • JDK

      public static final LanguageRangeEquivalents JDK
      Use the running JDK's own table, through Locale.LanguageRange.parse(String).

      That table is bundled with the JDK and differs between JDK releases, including update releases, so the same request can select a different locale on a different JVM. This reproduces the behavior of Lokalized 3.0.0, which always used the running JDK's table.

  • Method Details

    • values

      public static LanguageRangeEquivalents[] 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 LanguageRangeEquivalents 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