Make HTML lang attribute dynamic based on selected language

- Create HtmlLang client component that updates document.documentElement.lang
- Add HtmlLang component to layout.tsx to sync HTML lang attribute with locale
- HTML lang now updates automatically when user changes language
This commit is contained in:
counterweight 2025-12-26 11:38:38 +01:00
parent e35e79e84d
commit 0378a8edd7
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 21 additions and 0 deletions

View file

@ -1,5 +1,6 @@
import { AuthProvider } from "./auth-context";
import { Providers } from "./components/Providers";
import { HtmlLang } from "./components/HtmlLang";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
@ -39,6 +40,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</head>
<body>
<Providers>
<HtmlLang />
<AuthProvider>{children}</AuthProvider>
</Providers>
</body>