Sync console document lang with i18next locale

Static lang=\"en\" in index.html left French UI declared as English
for assistive tech. Mirror the compliance portal by updating
document.documentElement.lang on init and when the locale changes.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
Cursor Agent
2026-07-29 16:39:58 +00:00
parent 4960abab9e
commit 6cbfe7e755

View File

@@ -29,6 +29,12 @@ import { resolveLanguage, SUPPORTED_LANGUAGES } from "./resolveLanguage";
// react-i18next's hooks read from, so no I18nextProvider is required.
const i18n = createInstance();
function syncDocumentLanguage(language: string) {
document.documentElement.lang = language;
}
i18n.on("languageChanged", syncDocumentLanguage);
void i18n
.use(globBackend)
.use(initReactI18next)
@@ -42,6 +48,9 @@ void i18n
ns: [DEFAULT_NAMESPACE],
interpolation: { escapeValue: false },
react: { useSuspense: true },
})
.then(() => {
syncDocumentLanguage(i18n.language);
});
export { i18n };