Skip to content

API reference / @localizer/core / getPrimaryLocale

Function: getPrimaryLocale() ​

getPrimaryLocale(locale): LocaleCode

Defined in: fn/locale/get-primary-locale.ts:31

Returns the primary locale for a given locale code.

If the locale includes a country, it maps to the primary locale for that country using primaryLocales. Otherwise, the original locale is returned.

Parameters ​

ParameterTypeDescription
localeLocaleCodeThe locale code to process.

Returns ​

LocaleCode

The primary locale or the original locale if no mapping exists.