sanity
sanity copied to clipboard
feat(i18n): resolve preferred locale from browser languages
Description
Note: builds on #5381
Uses browsers' navigator.languages
to resolve the preferred locale to use. Explicit user preference still has preference, and we still fall back to the default locale (English (US)) if none of the preferred locales can be found.
It also adds the ability for users to explicitly set an array of preferred languages (in order of preference), or use the reducer pattern we've established in configuration to "dynamically" resolve it.
Made somewhat more complicated than I hoped because browsers use macro languages such as no
if not explicitly setting "Norwegian (Bokmål)" for instance, so had to introduced a macroLanguage
prop to locales that will need to be set for nb-NO
and nn-NO
packs (and possibly others).
Note: This also reverts back to showing all available locales, and is likely to linger here until we land schema localization, thus marked as draft.