feat: add Polish and English language switcher
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user