mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
feat(i18n): integrate next-intl and dynamic locale support in RootLayout
This commit is contained in:
parent
8673e4615a
commit
30922a25bb
@ -1,6 +1,8 @@
|
|||||||
import "@/app/globals.css";
|
import "@/app/globals.css";
|
||||||
import { Toaster } from "sonner";
|
import { Toaster } from "sonner";
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
|
import { getLocale } from "next-intl/server";
|
||||||
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
import { ThemeProvider } from "@/components/theme-provider";
|
import { ThemeProvider } from "@/components/theme-provider";
|
||||||
import { SettingsDialog } from "@/components/settings-dialog";
|
import { SettingsDialog } from "@/components/settings-dialog";
|
||||||
|
|
||||||
@ -14,10 +16,13 @@ interface RootLayoutProps {
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function RootLayout({ children }: RootLayoutProps) {
|
export default async function RootLayout({ children }: RootLayoutProps) {
|
||||||
|
const locale = await getLocale();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en" className="h-full" suppressHydrationWarning>
|
<html lang={locale} className="h-full" suppressHydrationWarning>
|
||||||
<body className="flex min-h-full antialiased">
|
<body className="flex min-h-full antialiased">
|
||||||
|
<NextIntlClientProvider>
|
||||||
<ThemeProvider
|
<ThemeProvider
|
||||||
attribute="class"
|
attribute="class"
|
||||||
defaultTheme="system"
|
defaultTheme="system"
|
||||||
@ -28,6 +33,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
<SettingsDialog />
|
<SettingsDialog />
|
||||||
<Toaster position="top-right" />
|
<Toaster position="top-right" />
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
|
</NextIntlClientProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user