Files
gitlab-instance-0a899031_cn…/app/[locale]/layout.tsx
2026-03-09 05:07:59 -05:00

43 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { LocaleProvider } from "../context/LocaleContext";
import type { Locale } from "../context/LocaleContext";
import { getThemeMessages } from "@/app/lib/theme-data";
import Navbar from "../components/Navbar";
import SetLangAttr from "../components/SetLangAttr";
const LOCALES: Locale[] = ["zh", "en"];
export const metadata: Metadata = {
title: "游牧中国 NomadCNA - 数字游民生活操作系统",
description:
"数字游民的一站式生活操作系统:城市决策、税务签证、智能匹配、赏金任务。从 Free 到 Pro开启你的游牧人生",
};
export function generateStaticParams() {
return LOCALES.map((locale) => ({ locale }));
}
export default async function LocaleLayout({
children,
params,
}: {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
if (!LOCALES.includes(locale as Locale)) {
notFound();
}
const messages = await getThemeMessages(locale as Locale);
return (
<LocaleProvider locale={locale as Locale} messages={messages}>
<SetLangAttr />
<Navbar />
{children}
</LocaleProvider>
);
}