001/* 002 * Copyright 2017-2022 Product Mog LLC, 2022-2026 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.lokalized; 018 019/** 020 * Controls where Lokalized takes IANA language-range equivalences from when it parses language ranges, such as the 021 * {@code he}/{@code iw} pair that makes a request for either language also consider the other. 022 * <p> 023 * The source decides which equivalent ranges {@link LocaleMatcher#parseLanguageRanges(String)} and 024 * {@link LocaleMatcher#bestMatchForAcceptLanguage(String)} add, and which ranges locale matching treats as equivalent, 025 * so it can change which loaded locale a request selects. Configure it with 026 * {@link Strings.Builder#languageRangeEquivalents(LanguageRangeEquivalents)}. 027 * 028 * @author <a href="https://revetkn.com">Mark Allen</a> 029 * @since 3.1.0 030 */ 031public enum LanguageRangeEquivalents { 032 /** 033 * Use the IANA Language Subtag Registry snapshot bundled in Lokalized: {@code File-Date: 2026-09-17}, SHA-256 034 * {@code 755fad43283be7b41ebe3c89ad054b6eaf928f404f9c0edb74799e0eab74beb1}. 035 * <p> 036 * The equivalents it supplies are identical on every JDK. This is the default. 037 */ 038 IANA_REGISTRY, 039 /** 040 * Use the running JDK's own table, through {@link java.util.Locale.LanguageRange#parse(String)}. 041 * <p> 042 * That table is bundled with the JDK and differs between JDK releases, including update releases, so the same 043 * request can select a different locale on a different JVM. This reproduces the behavior of Lokalized 3.0.0, which 044 * always used the running JDK's table. 045 */ 046 JDK 047}