Aller au contenu

detectPageLanguage

Ce contenu n’est pas encore disponible dans votre langue.

detectPageLanguage(): Language | undefined

Defined in: utils/i18n/detectPageLanguage.ts:20

Best-effort detection of the page’s intended content language for SDK copy.

Precedence: the document’s declared <html lang> (the page author’s explicit content language) → the browser UI language (navigator.language). Returns undefined when neither resolves to a supported language, letting callers apply their own fallback (e.g. "en").

The <html lang> check comes first so a page authored in French renders French SDK copy even when the visitor’s browser is set to another language.

Language | undefined