Skip to content

Commit e1a5314

Browse files
committed
Fix: make sure to use hyphen on lang attribute
1 parent 107eb36 commit e1a5314

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ export function getActiveLanguage(): string {
8888
*/
8989
function setLanguage({ lang, messages }: LanguageInterface): string {
9090
if (! isServer) {
91-
document.querySelector('html').setAttribute('lang', lang)
91+
// When setting the HTML lang attribute, hyphen must be use instead of underscore.
92+
document.documentElement.setAttribute("lang", lang.replace('_', '-'));
9293
}
9394

9495
options.lang = lang;

0 commit comments

Comments
 (0)