Lokalized JavaScript — Version 1.0.0
    Preparing search index...

    Function chooseLocaleForPreferredLanguages

    • Choose the first supported match from an ordered list of preferred language tags, examining at most 32 entries. Malformed or unmatched entries are skipped; if none match, return the resolved fallback locale.

      Use this for preference lists such as navigator.languages. For weighted Accept-Language negotiation, use lokalized/negotiate.

      Parameters

      • configuration: {
            fallbackLocale: string;
            supportedLocales: readonly string[];
            tiebreakerLocalesByLanguageCode?:
                | Readonly<Record<string, readonly string[]>>
                | ReadonlyMap<string, readonly string[]>
                | null;
        }
      • languages: Iterable<string>

        the caller's preference list, most-preferred first.

      Returns string

      the selected supported locale, or the resolved fallback