Setu-TS
    Preparing search index...
    • Picks the first supported locale a client's candidates select.

      Each candidate is canonicalized (a malformed one is skipped), matched exactly, then with subtags stripped right-to-left (de-Latn-AT → de-Latn → de). Intl.Locale.minimize is deliberately not used: it leaves de-AT as de-AT. A * candidate selects the first supported locale that no excluded range covers; exclusion applies to * only.

      Parameters

      • candidates: readonly string[]

        Client preferences, highest first

      • supported: readonly string[]

        The application's supported tags, default first

      • excluded: readonly string[] = []

        Ranges the client marked q=0

      Returns string | undefined

      The matched supported tag, or undefined when nothing matched

      negotiateLocale(['de-AT', 'en'], ['en', 'de']); // 'de'
      negotiateLocale(['*'], ['en', 'fr'], ['en']); // 'fr'

      0.9.0