feat: save locale in cookies

This commit is contained in:
Henry Li
2026-01-20 16:00:39 +08:00
parent 32a45eb043
commit faba2784e1
7 changed files with 131 additions and 38 deletions

View File

@@ -4,6 +4,8 @@ import { type Metadata } from "next";
import { Geist } from "next/font/google";
import { ThemeProvider } from "@/components/theme-provider";
import { I18nProvider } from "@/core/i18n/context";
import { detectLocaleServer } from "@/core/i18n/server";
export const metadata: Metadata = {
title: "Welcome to DeerFlow",
@@ -16,11 +18,13 @@ const geist = Geist({
variable: "--font-geist-sans",
});
export default function RootLayout({
export default async function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
const locale = await detectLocaleServer();
return (
<html
lang={locale}
className={geist.variable}
suppressContentEditableWarning
suppressHydrationWarning
@@ -32,7 +36,7 @@ export default function RootLayout({
enableSystem
disableTransitionOnChange
>
{children}
<I18nProvider initialLocale={locale}>{children}</I18nProvider>
</ThemeProvider>
</body>
</html>