添加i18n

This commit is contained in:
2025-12-18 18:32:35 +08:00
parent ebe385a624
commit cd40c603a1
17 changed files with 597 additions and 112 deletions
+22 -9
View File
@@ -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 (
<html lang="zh-CN">
<html lang={locale}>
<body
className={`${playfairDisplay.variable} ${notoSerifSC.variable} antialiased selection:bg-feie-gold selection:text-white`}
>
<Navbar />
{children}
<Footer />
<NextIntlClientProvider messages={messages}>
<Navbar />
{children}
<Footer />
</NextIntlClientProvider>
</body>
</html>
);
}