setup intl for multi language website and make hero and services and projects components in home dynamic and optimized
This commit is contained in:
18
src/i18n.ts
Normal file
18
src/i18n.ts
Normal 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,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user