fixed multi language

This commit is contained in:
2026-04-15 12:55:25 +03:30
parent 817bad53ec
commit f915213c16
7 changed files with 21 additions and 19 deletions

View File

@@ -1,10 +1,10 @@
export type Direction = 'ltr' | 'rtl'
export type Direction = "ltr" | "rtl";
export const localeDirectionMap: Record<string, Direction> = {
en: 'ltr',
fa: 'rtl',
}
en: "ltr",
ar: "rtl",
};
export function getDirection(locale: string): Direction {
return localeDirectionMap[locale] ?? 'ltr'
return localeDirectionMap[locale] ?? "ltr";
}

View File

@@ -6,6 +6,8 @@ export default getRequestConfig(async ({ requestLocale }) => {
const requested = await requestLocale;
const locale = hasLocale(routing.locales, requested) ? requested : routing.defaultLocale;
console.log("locale: ", locale);
return {
locale,
messages: (await import(`../../messages/${locale}.json`)).default,

View File

@@ -1,8 +1,7 @@
import { defineRouting } from 'next-intl/routing'
import { defineRouting } from "next-intl/routing";
export const routing = defineRouting({
locales: ['en', 'fa'],
defaultLocale: 'en',
localePrefix: 'never',
localeDetection: false,
})
locales: ["en", "ar"],
defaultLocale: "en",
localePrefix: "never",
});