request list + structure

This commit is contained in:
hamid zarghami
2025-10-20 12:28:48 +03:30
commit dbe37e371e
89 changed files with 9547 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
export const fa = {
sidebar: {
menu: "منو",
mainPage: "صفحه اصلی",
other: "سایر",
logout: "خروج",
myOrders: "سفارشات من",
preFactors: "پیش فاکتورها",
tickets: "تیکت ها",
announcement: "انتشارات",
criticisms: "انتقادات",
learning: "آموزش",
submitYourOrder: "سفارش خودرا ثبت کنید",
submitYourOrderDescription: "کارت ویزیت ، کاتالوگ ، بروشور و...",
newOrder: "سفارش جدید",
},
notif: {
natification: "اعلان‌ها",
all_read: "خواندن همه",
},
header: {
search: "جستجو",
},
home: {
requestCount: "تعداد درخواست ها",
factureCount: "پیش فاکتور تایید نشده",
orderCount: "سفارش های در حال انجام",
orderDoneCount: "سفارشات انجام شده",
services: "خدمات",
submitNewOrder: "سفارش خودرا ثبت کنید",
submitNewOrderButton: "سفارش جدید",
specialSolution: "راه‌حل اختصاصی برای شما در نگاره!",
specialSolutionDescription: "چاپ سریع، دقیق و خلاقانه برای کسب‌وکار شما!",
specialSolutionFeature1: "متناسب با حوزه‌ی فعالیت شما و نیازهای برندتان",
specialSolutionFeature2:
"با بیش از ۲۸ سال تجربه‌ی حرفه‌ای در چاپ و تبلیغات",
specialSolutionFeature3: "رعایت بهترین استانداردهای کیفیت و طراحی",
freeConsultation: "دریافت مشاوره رایگان",
contactUs: "با ما تماس بگیرید",
phoneNumber: "۰۸۶۹۱۰۰۹۰۰۱",
},
uploadBox: {
selectFile: "انتخاب فایل",
},
};
+39
View File
@@ -0,0 +1,39 @@
import { fa } from "./fa";
export type LocaleKey = "fa";
export interface TranslationsType {
[key: string]: string | TranslationsType;
}
const locales: Record<LocaleKey, TranslationsType> = { fa };
let currentLang: LocaleKey = "fa";
export const setLang = (lang: LocaleKey) => {
currentLang = lang;
};
export const getLang = (): LocaleKey => currentLang;
const cache = new Map<string, string>();
export const t = (key: string, fallback?: string): string => {
const cacheKey = `${currentLang}:${key}`;
if (cache.has(cacheKey)) return cache.get(cacheKey)!;
const keys = key.split(".");
let value: string | TranslationsType | undefined = locales[currentLang];
for (const k of keys) {
if (typeof value === "object" && value !== null) {
value = value[k];
} else {
value = undefined;
break;
}
}
const result = typeof value === "string" ? value : fallback || key;
cache.set(cacheKey, result);
return result;
};