Skip to content

Commit 3808801

Browse files
authored
Keep the HTML lang attribute in sync with the i18next language (#3247)
1 parent 8828b70 commit 3808801

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/initializer.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ export class Initializer {
136136
lookup: () => getUrlParams().lang ?? undefined,
137137
});
138138

139+
// Synchronise the HTML lang attribute with the i18next language
140+
i18n.on("languageChanged", (lng) => {
141+
document.documentElement.lang = lng;
142+
});
143+
139144
await i18n
140145
.use(Backend)
141146
.use(languageDetector)

0 commit comments

Comments
 (0)