Function: negotiateLocale()
negotiateLocale(
__namedParameters):string
Defined in: negotiateLocale.ts:55
Pick the supported locale that best serves what was requested — a user
preference, an Accept-Language header, or both in priority order.
For each requested locale, in order: an exact match, then the locale with
its subtags dropped one at a time (pt-BR → pt), then any supported
locale of the same language (pt-PT → pt-BR). Only when no requested
locale matches at all does fallback apply.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { fallback: string; requested?: string | string[] | null; supported: string[]; } |
__namedParameters.fallback | string |
__namedParameters.requested? | string | string[] | null |
__namedParameters.supported | string[] |
Returns
string