Resolution checks the fixed lang URL query, the supplied local-storage
key, navigator.language, and finally the fixed en fallback. Each value
is trimmed, treats _ as -, and is canonicalized as a language tag.
navigator.languages is intentionally ignored.
The label is generated at runtime with Intl.DisplayNames in the resolved
language when available. Runtime wording may vary; the canonical language
value is used as the label when display-name generation is unavailable.
The canonical current language and a runtime-generated display label.
Throws
If storageKey is not a non-empty string.
Remarks
Safe during SSR and resilient to unavailable or throwing browser and Intl APIs. This function reads preferences only and never writes storage, mutates the DOM, loads translations, redirects, or adds listeners.
Resolve the current website language.
Resolution checks the fixed
langURL query, the supplied local-storage key,navigator.language, and finally the fixedenfallback. Each value is trimmed, treats_as-, and is canonicalized as a language tag.navigator.languagesis intentionally ignored.The label is generated at runtime with
Intl.DisplayNamesin the resolved language when available. Runtime wording may vary; the canonical language value is used as the label when display-name generation is unavailable.Usage:
Possible output: