Example 1 — Read Language
Log the preferred BCP 47 language tag.
const tag = navigator.language;
console.log(tag); How It Works
- Read the property.
navigator.languagereturns a string. - Expect BCP 47. Forms like
enoren-US(MDN). - It is read-only. Users change language in browser/OS settings.
- Use it as a locale. Pass the tag to
Intlor i18n loaders.

