fixed multi language
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user