diff --git a/messages/en.json b/messages/en.json new file mode 100644 index 0000000..5fa1a11 --- /dev/null +++ b/messages/en.json @@ -0,0 +1,5 @@ +{ + "Home": { + "title": "Title" + } +} diff --git a/src/app/layout.tsx b/src/app/[locale]/layout.tsx similarity index 52% rename from src/app/layout.tsx rename to src/app/[locale]/layout.tsx index bc0a13e..0e0ca91 100644 --- a/src/app/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -1,18 +1,33 @@ +import { getDirection } from '@/i18n/direction' +import { routing } from '@/i18n/routing' import { ClientAppProvider } from '@/providers/ClientAppProvider' import '@/styles/globals.css' import type { Metadata } from 'next' +import { hasLocale, NextIntlClientProvider } from 'next-intl' +import { getMessages } from 'next-intl/server' +import { notFound } from 'next/navigation' export const metadata: Metadata = { title: 'Theater of dreams', } -export default function RootLayout({ +export default async function RootLayout({ children, -}: { + params, +}: Readonly<{ children: React.ReactNode -}) { + params: Promise<{ locale: string }> +}>) { + const { locale } = await params + if (!hasLocale(routing.locales, locale)) { + notFound() + } + + const messages = await getMessages() + const dir = getDirection(locale) + return ( - +
{/* Prevent theme flicker before hydration */}