mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 14:56:36 +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 { Toaster } from "sonner";
|
||||
import type { Metadata } from "next";
|
||||
import { getLocale } from "next-intl/server";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { ThemeProvider } from "@/components/theme-provider";
|
||||
import { SettingsDialog } from "@/components/settings-dialog";
|
||||
|
||||
@ -14,20 +16,24 @@ interface RootLayoutProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function RootLayout({ children }: RootLayoutProps) {
|
||||
export default async function RootLayout({ children }: RootLayoutProps) {
|
||||
const locale = await getLocale();
|
||||
|
||||
return (
|
||||
<html lang="en" className="h-full" suppressHydrationWarning>
|
||||
<html lang={locale} className="h-full" suppressHydrationWarning>
|
||||
<body className="flex min-h-full antialiased">
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
<div className="w-full">{children}</div>
|
||||
<SettingsDialog />
|
||||
<Toaster position="top-right" />
|
||||
</ThemeProvider>
|
||||
<NextIntlClientProvider>
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
<div className="w-full">{children}</div>
|
||||
<SettingsDialog />
|
||||
<Toaster position="top-right" />
|
||||
</ThemeProvider>
|
||||
</NextIntlClientProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user