Skip to main content

Function: negotiateLocale()

function negotiateLocale(
requested,
available,
defaultLocale
): string;

Defined in: packages/core/src/i18n/locale.ts:168

BCP 47 lookup with subtag truncation, then a same-language best fit, in requested order. Returns defaultLocale when nothing matches.

No macrolanguage guessing: ckb never resolves to ku, and zh-Hant never resolves to zh-Hans.

Parameters

ParameterType
requestedreadonly string[]
availablereadonly string[]
defaultLocalestring

Returns

string