Add FA, EN, and AR static copy, with English LTR and catalog hidden outside Persian.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
51fb9f6a26
commit
6543c994c3
@@ -0,0 +1,14 @@
|
||||
import { ar } from "@/i18n/ar";
|
||||
import { defaultLocale, isLocale, type Locale } from "@/i18n/config";
|
||||
import { en } from "@/i18n/en";
|
||||
import { fa, type Messages } from "@/i18n/fa";
|
||||
|
||||
export const dictionaries: Record<Locale, Messages> = { fa, en, ar };
|
||||
|
||||
export function getMessages(locale: Locale | string | null | undefined): Messages {
|
||||
return dictionaries[isLocale(locale) ? locale : defaultLocale];
|
||||
}
|
||||
|
||||
export function interpolate(template: string, vars: Record<string, string>) {
|
||||
return Object.entries(vars).reduce((text, [key, value]) => text.split(`{${key}}`).join(value), template);
|
||||
}
|
||||
Reference in New Issue
Block a user