diff --git a/app/layout.tsx b/app/[locale]/layout.tsx similarity index 63% rename from app/layout.tsx rename to app/[locale]/layout.tsx index 207b82e..86413e3 100644 --- a/app/layout.tsx +++ b/app/[locale]/layout.tsx @@ -1,8 +1,11 @@ import type { Metadata } from "next"; import { Playfair_Display, Noto_Serif_SC } from "next/font/google"; -import "./globals.css"; +import "../globals.css"; import Navbar from "@/components/Navbar"; import Footer from "@/components/Footer"; +import {NextIntlClientProvider} from 'next-intl'; +import {getMessages} from 'next-intl/server'; +import {notFound} from 'next/navigation'; const playfairDisplay = Playfair_Display({ variable: "--font-serif", @@ -22,21 +25,31 @@ export const metadata: Metadata = { description: "南京市肥鹅信息技术有限公司致力于为企业提供卓越的数字化解决方案,以创新技术驱动商业价值。", }; -export default function RootLayout({ +export default async function LocaleLayout({ children, -}: Readonly<{ + params +}: { children: React.ReactNode; -}>) { + params: Promise<{locale: string}>; +}) { + const { locale } = await params; + if (!['en', 'zh', 'ja'].includes(locale)) { + notFound(); + } + + const messages = await getMessages(); + return ( - + - - {children} -