36 lines
922 B
TypeScript
36 lines
922 B
TypeScript
|
|
import '@/app/globals.css';
|
||
|
|
import { notFound } from 'next/navigation';
|
||
|
|
import { NextIntlClientProvider } from 'next-intl';
|
||
|
|
import type { ILayoutLocaleParams } from '@/models/layout.d';
|
||
|
|
|
||
|
|
// export const metadata: Metadata = {
|
||
|
|
// title: 'Create Next App',
|
||
|
|
// description: 'Generated by create next app',
|
||
|
|
// };
|
||
|
|
|
||
|
|
export default async function RootLayout({
|
||
|
|
children,
|
||
|
|
params,
|
||
|
|
}: Readonly<{
|
||
|
|
children: React.ReactNode;
|
||
|
|
params: ILayoutLocaleParams;
|
||
|
|
}>) {
|
||
|
|
const locale = params.locale;
|
||
|
|
let messages;
|
||
|
|
try {
|
||
|
|
messages = (await import(`../../../messages/${locale}.json`)).default;
|
||
|
|
} catch (error) {
|
||
|
|
notFound();
|
||
|
|
}
|
||
|
|
|
||
|
|
return (
|
||
|
|
<html lang={locale} dir={locale === 'fa' ? 'rtl' : 'ltr'}>
|
||
|
|
<body className="min-h-svh w-full overflow-x-hidden">
|
||
|
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
||
|
|
{children}
|
||
|
|
</NextIntlClientProvider>
|
||
|
|
</body>
|
||
|
|
</html>
|
||
|
|
);
|
||
|
|
}
|