setup intl for multi language website and make hero and services and projects components in home dynamic and optimized

This commit is contained in:
Pouya Defaei
2026-04-25 13:27:13 +03:30
parent d1d9c309f8
commit 8c051c3533
28 changed files with 1257 additions and 218 deletions

18
src/i18n.ts Normal file
View File

@@ -0,0 +1,18 @@
// src/i18n.ts
import { getRequestConfig } from "next-intl/server";
import { notFound } from "next/navigation";
const locales = ["fa", "en", "ar"];
export default getRequestConfig(async ({ requestLocale }) => {
let locale = await requestLocale;
if (!locale || !locales.includes(locale as string)) {
locale = "fa";
}
return {
locale,
messages: (await import(`./messages/${locale}.json`)).default,
};
});