diff --git a/messages/ar.json b/messages/ar.json new file mode 100644 index 0000000..2e55808 --- /dev/null +++ b/messages/ar.json @@ -0,0 +1,5 @@ +{ + "Home": { + "title": "مرحبا" + } +} diff --git a/messages/en.json b/messages/en.json new file mode 100644 index 0000000..6e88cea --- /dev/null +++ b/messages/en.json @@ -0,0 +1,5 @@ +{ + "Home": { + "title": "hello" + } +} diff --git a/messages/fa.json b/messages/fa.json index 24e9065..9cf9fe4 100644 --- a/messages/fa.json +++ b/messages/fa.json @@ -1,4 +1,5 @@ -{ - "loading": "درحال دریافت داده", - "error_fetch_data": "مشکلی در دریافت داده رخ داده است." -} +{ + "Home": { + "title": "سلام" + } +} diff --git a/messages/ku.json b/messages/ku.json new file mode 100644 index 0000000..2e55808 --- /dev/null +++ b/messages/ku.json @@ -0,0 +1,5 @@ +{ + "Home": { + "title": "مرحبا" + } +} diff --git a/next-env.d.ts b/next-env.d.ts index 9edff1c..c4b7818 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/types/routes.d.ts"; +import "./.next/dev/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/package.json b/package.json index 438764d..8e1a470 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "witelflix", + "name": "cinematales", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/layout.tsx b/src/app/[locale]/layout.tsx similarity index 67% rename from src/app/layout.tsx rename to src/app/[locale]/layout.tsx index 3d45b2c..4f55e96 100644 --- a/src/app/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -1,8 +1,11 @@ +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 { getLocale, getMessages } from "next-intl/server"; -import { NextIntlClientProvider } from "next-intl"; +import { hasLocale, NextIntlClientProvider } from "next-intl"; +import { getMessages } from "next-intl/server"; +import { notFound } from "next/navigation"; export const metadata: Metadata = { title: { @@ -33,11 +36,23 @@ export const viewport = { maximumScale: 1, }; -export default async function RootLayout({ children }: { children: React.ReactNode }) { - const locale = await getLocale(); - const messages = await getMessages({ locale }); +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 */}