feat: Add complete i18n system with Arabic/English translations

Bilingual support infrastructure:
- ar.json: Full Arabic translations (120+ strings)
  - Navigation, hero, pain points, features, pricing, dashboard, marketers
- en.json: Full English translations (120+ strings)
- index.tsx: I18nProvider with context, useI18n hook, LanguageSwitcher component
  - LocalStorage persistence, RTL/LTR auto-switching
  - Nested key resolution (e.g., "dashboard.tabs.overview")
  - Arabic default with instant English toggle

https://claude.ai/code/session_01LsnvBa7HwF5hs99VZbgLGj
This commit is contained in:
Claude 2026-04-12 01:30:53 +00:00
parent aeedd20081
commit bbef680bc1
No known key found for this signature in database
3 changed files with 418 additions and 0 deletions

View File

@ -0,0 +1,165 @@
{
"app": {
"name": "Dealix",
"tagline": "نظام المبيعات الذكي للسعودية",
"description": "منصة تجارية مؤسسية تساعد الشركات على توليد الفرص وبناء الشراكات وإدارة الصفقات بذكاء"
},
"nav": {
"home": "الرئيسية",
"features": "المميزات",
"pricing": "الأسعار",
"about": "عن Dealix",
"contact": "تواصل معنا",
"login": "تسجيل الدخول",
"register": "إنشاء حساب",
"startFree": "ابدأ مجاناً",
"watchDemo": "شاهد العرض",
"dashboard": "لوحة التحكم",
"settings": "الإعدادات",
"logout": "تسجيل الخروج"
},
"hero": {
"title": "نظام المبيعات الذكي للسعودية",
"subtitle": "حوّل شركتك من مبيعات تقليدية إلى محرك نمو ذكي — اكتشف الفرص، ابنِ الشراكات، وأغلق الصفقات",
"cta1": "ابدأ مجاناً — ١٤ يوم",
"cta2": "شاهد كيف يعمل",
"stats": {
"companies": "+٥٠٠ شركة",
"satisfaction": "٩٥٪ رضا",
"deals": "+١٠٠٠ صفقة"
}
},
"painPoints": {
"title": "مشاكل يعاني منها كل مدير مبيعات",
"items": [
{ "title": "عملاء ضايعين", "desc": "٧٠٪ من العملاء المحتملين يضيعون بسبب عدم المتابعة" },
{ "title": "فوضى الواتساب", "desc": "رسائل ضايعة وما تعرف مين رد ومين لا" },
{ "title": "بدون تقارير", "desc": "ما تعرف أداء فريقك ولا وين المشكلة" },
{ "title": "فرص ضائعة", "desc": "شراكات وصفقات ممكن تغير كل شي لكن ما تعرف عنها" }
]
},
"features": {
"title": "كل ما تحتاجه في مكان واحد",
"items": [
{ "title": "واتساب ذكي", "desc": "تواصل مع عملاءك من الواتساب مباشرة مع رد تلقائي بالعربي" },
{ "title": "تقييم عملاء AI", "desc": "الذكاء الاصطناعي يقيّم كل عميل ويقولك مين الأهم" },
{ "title": "مسار صفقات بصري", "desc": "شوف كل صفقاتك بنظرة واحدة وحركها بالسحب" },
{ "title": "عروض أسعار احترافية", "desc": "أنشئ عروض أسعار بالعربي مع ضريبة القيمة المضافة تلقائياً" },
{ "title": "حماية البيانات PDPL", "desc": "متوافق مع نظام حماية البيانات الشخصية السعودي" },
{ "title": "تقارير وتحليلات", "desc": "اعرف أداء فريقك ومبيعاتك بتقارير يومية تلقائية" }
]
},
"howItWorks": {
"title": "كيف يعمل Dealix؟",
"steps": [
{ "num": "١", "title": "سجّل شركتك", "desc": "أنشئ حسابك بأقل من دقيقة" },
{ "num": "٢", "title": "أضف عملاءك", "desc": "استورد عملاءك أو ابدأ من الصفر" },
{ "num": "٣", "title": "ابدأ البيع", "desc": "النظام يتابع ويذكرك ويساعدك تغلق أكثر" }
]
},
"pricing": {
"title": "اختر الباقة المناسبة",
"currency": "ر.س",
"period": "شهرياً",
"popular": "الأكثر شعبية",
"startTrial": "ابدأ التجربة المجانية",
"contactSales": "تواصل مع المبيعات",
"plans": [
{
"name": "Starter",
"nameAr": "المبتدئ",
"price": "٥٩",
"features": ["٣ مستخدمين", "٥٠٠ عميل", "واتساب أساسي", "تقارير أساسية"]
},
{
"name": "Professional",
"nameAr": "الاحترافي",
"price": "١٤٩",
"popular": true,
"features": ["١٠ مستخدمين", "عملاء لا محدود", "تقييم AI", "تسلسلات تلقائية", "عروض أسعار", "تقارير متقدمة"]
},
{
"name": "Enterprise",
"nameAr": "المؤسسي",
"price": "٢٢٥",
"features": ["مستخدمين لا محدود", "وكيل مبيعات AI", "صفقات استراتيجية", "API كامل", "دعم مخصص"]
}
]
},
"cta": {
"title": "جاهز تنقل مبيعاتك للمستوى التالي؟",
"subtitle": "١٤ يوم تجربة مجانية — بدون بطاقة ائتمانية",
"button": "ابدأ الآن مجاناً"
},
"footer": {
"product": "المنتج",
"company": "الشركة",
"support": "الدعم",
"legal": "قانوني",
"privacy": "سياسة الخصوصية",
"terms": "الشروط والأحكام",
"madeIn": "صنع بحب في السعودية"
},
"dashboard": {
"tabs": {
"overview": "لوحة القيادة",
"pipeline": "مسار الصفقات",
"inbox": "صندوق الوارد",
"scoring": "تقييم العملاء",
"leads": "العملاء المحتملين",
"deals": "الصفقات",
"partners": "الشركاء",
"analytics": "التحليلات",
"settings": "الإعدادات"
},
"kpis": {
"totalLeads": "إجمالي العملاء",
"newToday": "جديد اليوم",
"openDeals": "صفقات مفتوحة",
"wonValue": "قيمة المكسوب",
"conversionRate": "معدل التحويل",
"responseTime": "وقت الاستجابة"
},
"empty": {
"noLeads": "لا يوجد عملاء بعد — أضف أول عميل",
"noDeals": "لا توجد صفقات — أنشئ أول صفقة",
"noMessages": "لا توجد رسائل — ابدأ محادثة"
}
},
"marketers": {
"title": "انضم لفريق مسوقي Dealix",
"subtitle": "اكسب عمولات على كل عميل تجيبه — بدون راتب ثابت، بدون حدود",
"cta": "سجّل كمسوّق",
"benefits": [
{ "title": "عمولة فورية", "desc": "احصل على عمولتك مع كل صفقة ناجحة" },
{ "title": "أدوات احترافية", "desc": "نظام متابعة كامل وقوالب جاهزة" },
{ "title": "دعم مستمر", "desc": "فريق دعم متخصص يساعدك تنجح" },
{ "title": "شفافية كاملة", "desc": "تابع كل عمولاتك ونتائجك لحظة بلحظة" }
],
"stats": {
"avgCommission": "متوسط العمولة الشهرية",
"activeMarketers": "مسوّق نشط",
"totalPaid": "إجمالي المدفوعات"
}
},
"common": {
"loading": "جاري التحميل...",
"error": "حدث خطأ — حاول مرة أخرى",
"save": "حفظ",
"cancel": "إلغاء",
"delete": "حذف",
"edit": "تعديل",
"search": "بحث...",
"filter": "تصفية",
"export": "تصدير",
"import": "استيراد",
"confirm": "تأكيد",
"back": "رجوع",
"next": "التالي",
"previous": "السابق",
"yes": "نعم",
"no": "لا",
"sar": "ر.س",
"noResults": "لا توجد نتائج"
}
}

View File

@ -0,0 +1,162 @@
{
"app": {
"name": "Dealix",
"tagline": "The Smart Sales System for Saudi Arabia",
"description": "An enterprise commercial platform that helps companies generate opportunities, build partnerships, and manage deals intelligently"
},
"nav": {
"home": "Home",
"features": "Features",
"pricing": "Pricing",
"about": "About",
"contact": "Contact",
"login": "Log In",
"register": "Sign Up",
"startFree": "Start Free",
"watchDemo": "Watch Demo",
"dashboard": "Dashboard",
"settings": "Settings",
"logout": "Log Out"
},
"hero": {
"title": "The Smart Sales System for Saudi Arabia",
"subtitle": "Transform your company from traditional sales to an intelligent growth engine — discover opportunities, build partnerships, and close deals",
"cta1": "Start Free — 14 Days",
"cta2": "See How It Works",
"stats": {
"companies": "500+ Companies",
"satisfaction": "95% Satisfaction",
"deals": "1000+ Deals"
}
},
"painPoints": {
"title": "Problems Every Sales Manager Faces",
"items": [
{ "title": "Lost Leads", "desc": "70% of potential clients are lost due to poor follow-up" },
{ "title": "WhatsApp Chaos", "desc": "Messages get lost and you don't know who replied" },
{ "title": "No Reports", "desc": "You don't know your team's performance or where problems are" },
{ "title": "Missed Opportunities", "desc": "Partnerships and deals that could change everything go unnoticed" }
]
},
"features": {
"title": "Everything You Need in One Place",
"items": [
{ "title": "Smart WhatsApp", "desc": "Communicate with clients directly via WhatsApp with Arabic auto-reply" },
{ "title": "AI Lead Scoring", "desc": "AI evaluates every client and tells you who matters most" },
{ "title": "Visual Pipeline", "desc": "See all your deals at a glance and move them with drag & drop" },
{ "title": "Professional Quotes", "desc": "Create Arabic quotes with automatic VAT calculation" },
{ "title": "PDPL Compliance", "desc": "Fully compliant with Saudi Personal Data Protection Law" },
{ "title": "Reports & Analytics", "desc": "Know your team's performance with automatic daily reports" }
]
},
"howItWorks": {
"title": "How Does Dealix Work?",
"steps": [
{ "num": "1", "title": "Register Your Company", "desc": "Create your account in less than a minute" },
{ "num": "2", "title": "Add Your Clients", "desc": "Import your clients or start from scratch" },
{ "num": "3", "title": "Start Selling", "desc": "The system follows up, reminds you, and helps you close more" }
]
},
"pricing": {
"title": "Choose Your Plan",
"currency": "SAR",
"period": "monthly",
"popular": "Most Popular",
"startTrial": "Start Free Trial",
"contactSales": "Contact Sales",
"plans": [
{
"name": "Starter",
"price": "59",
"features": ["3 users", "500 clients", "Basic WhatsApp", "Basic reports"]
},
{
"name": "Professional",
"price": "149",
"popular": true,
"features": ["10 users", "Unlimited clients", "AI scoring", "Auto sequences", "Quotes", "Advanced reports"]
},
{
"name": "Enterprise",
"price": "225",
"features": ["Unlimited users", "AI sales agent", "Strategic deals", "Full API", "Dedicated support"]
}
]
},
"cta": {
"title": "Ready to Take Your Sales to the Next Level?",
"subtitle": "14-day free trial — no credit card required",
"button": "Start Free Now"
},
"footer": {
"product": "Product",
"company": "Company",
"support": "Support",
"legal": "Legal",
"privacy": "Privacy Policy",
"terms": "Terms of Service",
"madeIn": "Made with love in Saudi Arabia"
},
"dashboard": {
"tabs": {
"overview": "Dashboard",
"pipeline": "Deal Pipeline",
"inbox": "Inbox",
"scoring": "Lead Scoring",
"leads": "Leads",
"deals": "Deals",
"partners": "Partners",
"analytics": "Analytics",
"settings": "Settings"
},
"kpis": {
"totalLeads": "Total Leads",
"newToday": "New Today",
"openDeals": "Open Deals",
"wonValue": "Won Value",
"conversionRate": "Conversion Rate",
"responseTime": "Response Time"
},
"empty": {
"noLeads": "No leads yet — add your first client",
"noDeals": "No deals yet — create your first deal",
"noMessages": "No messages yet — start a conversation"
}
},
"marketers": {
"title": "Join the Dealix Marketing Team",
"subtitle": "Earn commissions on every client you bring — no fixed salary, no limits",
"cta": "Register as Marketer",
"benefits": [
{ "title": "Instant Commission", "desc": "Get your commission with every successful deal" },
{ "title": "Pro Tools", "desc": "Complete tracking system and ready templates" },
{ "title": "Ongoing Support", "desc": "Dedicated support team to help you succeed" },
{ "title": "Full Transparency", "desc": "Track all your commissions and results in real-time" }
],
"stats": {
"avgCommission": "Average Monthly Commission",
"activeMarketers": "Active Marketers",
"totalPaid": "Total Paid Out"
}
},
"common": {
"loading": "Loading...",
"error": "An error occurred — please try again",
"save": "Save",
"cancel": "Cancel",
"delete": "Delete",
"edit": "Edit",
"search": "Search...",
"filter": "Filter",
"export": "Export",
"import": "Import",
"confirm": "Confirm",
"back": "Back",
"next": "Next",
"previous": "Previous",
"yes": "Yes",
"no": "No",
"sar": "SAR",
"noResults": "No results found"
}
}

View File

@ -0,0 +1,91 @@
"use client";
import React, { createContext, useContext, useState, useCallback, ReactNode } from "react";
import ar from "./ar.json";
import en from "./en.json";
type Locale = "ar" | "en";
type Translations = typeof ar;
interface I18nContextType {
locale: Locale;
t: (key: string) => string;
switchLocale: (locale: Locale) => void;
dir: "rtl" | "ltr";
isArabic: boolean;
}
const translations: Record<Locale, Translations> = { ar, en };
const I18nContext = createContext<I18nContextType | null>(null);
function getNestedValue(obj: any, path: string): string {
const keys = path.split(".");
let current = obj;
for (const key of keys) {
if (current === undefined || current === null) return path;
current = current[key];
}
return typeof current === "string" ? current : path;
}
export function I18nProvider({ children, defaultLocale = "ar" }: { children: ReactNode; defaultLocale?: Locale }) {
const [locale, setLocale] = useState<Locale>(() => {
if (typeof window !== "undefined") {
return (localStorage.getItem("dealix-locale") as Locale) || defaultLocale;
}
return defaultLocale;
});
const t = useCallback(
(key: string): string => {
return getNestedValue(translations[locale], key);
},
[locale]
);
const switchLocale = useCallback((newLocale: Locale) => {
setLocale(newLocale);
if (typeof window !== "undefined") {
localStorage.setItem("dealix-locale", newLocale);
document.documentElement.dir = newLocale === "ar" ? "rtl" : "ltr";
document.documentElement.lang = newLocale;
}
}, []);
const value: I18nContextType = {
locale,
t,
switchLocale,
dir: locale === "ar" ? "rtl" : "ltr",
isArabic: locale === "ar",
};
return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;
}
export function useI18n(): I18nContextType {
const context = useContext(I18nContext);
if (!context) {
throw new Error("useI18n must be used within I18nProvider");
}
return context;
}
export function LanguageSwitcher() {
const { locale, switchLocale } = useI18n();
return (
<button
onClick={() => switchLocale(locale === "ar" ? "en" : "ar")}
className="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-white/10 hover:bg-white/20
text-sm font-medium transition-all duration-200 backdrop-blur-sm border border-white/10"
aria-label="Switch language"
>
<span className="text-lg">{locale === "ar" ? "🇬🇧" : "🇸🇦"}</span>
<span>{locale === "ar" ? "English" : "عربي"}</span>
</button>
);
}
export type { Locale, I18nContextType };