feat: add Polish and English language switcher

This commit is contained in:
zv
2026-06-01 18:54:08 +02:00
parent 840555f4f5
commit 6c2e731c60
29 changed files with 531 additions and 143 deletions

View File

@@ -13,6 +13,11 @@ const themeScript = `
document.documentElement.classList.toggle("dark", storedTheme ? storedTheme === "dark" : prefersDark);
} catch {}
`;
const languageScript = `
try {
document.documentElement.lang = localStorage.getItem("wtr:language") === "en" ? "en" : "pl";
} catch {}
`;
export const metadata: Metadata = {
title: { default: "wtr. | Pogoda z danych IMGW", template: "%s | wtr." },
@@ -41,6 +46,7 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
<html lang="pl" suppressHydrationWarning data-scroll-behavior="smooth">
<body className={`${inter.variable} font-sans`}>
<Script id="wtr-theme" strategy="beforeInteractive">{themeScript}</Script>
<Script id="wtr-language" strategy="beforeInteractive">{languageScript}</Script>
<Providers>
<AppShell>{children}</AppShell>
</Providers>