20 lines
501 B
TypeScript
20 lines
501 B
TypeScript
|
|
"use client";
|
||
|
|
|
||
|
|
import { useEffect } from "react";
|
||
|
|
import { useLanguage } from "../hooks/useLanguage";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Client component that updates the HTML lang attribute based on the selected language.
|
||
|
|
* This must be a client component because it uses hooks and DOM manipulation.
|
||
|
|
*/
|
||
|
|
export function HtmlLang() {
|
||
|
|
const { locale } = useLanguage();
|
||
|
|
|
||
|
|
useEffect(() => {
|
||
|
|
// Update the HTML lang attribute when locale changes
|
||
|
|
document.documentElement.lang = locale;
|
||
|
|
}, [locale]);
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|