mirror of
https://github.com/massbug/judge4c.git
synced 2025-07-04 15:50:51 +00:00
38 lines
890 B
TypeScript
38 lines
890 B
TypeScript
import { NextIntlClientProvider } from 'next-intl';
|
|
import { notFound } from 'next/navigation';
|
|
import type { Metadata } from 'next';
|
|
|
|
export const metadata: Metadata = {
|
|
title: 'Judge4C',
|
|
description: 'Online Judge System',
|
|
};
|
|
|
|
export function generateStaticParams() {
|
|
return [{ locale: 'en' }, { locale: 'zh' }];
|
|
}
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params
|
|
}: {
|
|
children: React.ReactNode;
|
|
params: { locale: string };
|
|
}) {
|
|
const { locale } = await params;
|
|
let messages;
|
|
try {
|
|
messages = (await import(`../../../messages/${locale}.json`)).default;
|
|
} catch (error) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<html lang={locale} suppressHydrationWarning>
|
|
<body suppressHydrationWarning>
|
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
|
{children}
|
|
</NextIntlClientProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|