/** * i18n Translation Engine */ const i18n = { currentLang: localStorage.getItem('intaleq_lang') || 'en', translations: { en: { // Navbar 'nav-features': 'Features', 'nav-why': 'Why Us?', 'nav-pricing': 'Pricing', 'nav-launch': 'Launch Dashboard', 'lang-toggle': 'العربية', // Hero 'hero-badge': 'Now with 3D Buildings in Jordan & Syria', 'hero-title': 'The Map API That
Doesn\'t Break The Bank.', 'hero-desc': 'Build premium location-based apps with high-fidelity vector tiles, optimized routing, and 3D buildings. 85% cheaper than Google Maps.', 'hero-cta-start': 'Start Building Free', 'hero-cta-view': 'View Comparison', // Features 'feat-latency-title': 'Zero Latency', 'feat-latency-desc': 'Our infrastructure is optimized for MENA region, ensuring map tiles load in under 200ms.', 'feat-routing-title': 'Smart Routing', 'feat-routing-desc': 'Enterprise-grade routing engine with support for alternative paths and traffic awareness.', 'feat-geocoding-title': 'Local Geocoding', 'feat-geocoding-desc': 'Highly accurate search for local landmarks and neighborhoods in Jordan & Syria.', // Dashboard Sidebar 'side-dashboard': 'Dashboard', 'side-playground': 'Playground', 'side-analytics': 'Analytics', 'side-billing': 'Billing', 'side-audit': 'Place Audit', 'side-docs': 'Documentation', 'side-upgrade': 'Upgrade Plan', // Dashboard General 'welcome': 'Welcome back', 'system-status': 'System Operational', 'quota-card-title': 'Monthly Quota', 'requests-left': 'requests left', 'used-label': 'USED', // KPI Labels 'kpi-total-req': 'Total Requests', 'kpi-success-rate': 'Success Rate', 'kpi-active-keys': 'Active Keys', 'kpi-latency': 'Avg Latency', }, ar: { // Navbar 'nav-features': 'المميزات', 'nav-why': 'لماذا نحن؟', 'nav-pricing': 'الأسعار', 'nav-launch': 'لوحة التحكم', 'lang-toggle': 'English', // Hero 'hero-badge': 'الآن مع المباني ثلاثية الأبعاد في الأردن وسوريا', 'hero-title': 'واجهة خرائط برمجية
لا ترهق ميزانيتك.', 'hero-desc': 'ابنِ تطبيقات خرائط فاخرة مع خرائط مجهزة، توجيه ذكي، ومباني ثلاثية الأبعاد. أوفر بنسبة 85% من خرائط جوجل.', 'hero-cta-start': 'ابدأ مجاناً', 'hero-cta-view': 'قارن الأسعار', // Features 'feat-latency-title': 'سرعة فائقة', 'feat-latency-desc': 'بنيتنا التحتية محسنة لمنطقة الشرق الأوسط، مما يضمن تحميل الخرائط في أقل من 200 مللي ثانية.', 'feat-routing-title': 'توجيه ذكي', 'feat-routing-desc': 'محرك توجيه من الفئة المؤسسية يدعم المسارات البديلة والوعي بحركة المرور.', 'feat-geocoding-title': 'بحث مكاني محلي', 'feat-geocoding-desc': 'دقة عالية جداً في البحث عن المعالم والأحياء في الأردن وسوريا.', // Dashboard Sidebar 'side-dashboard': 'لوحة التحكم', 'side-playground': 'ساحة الاختبار', 'side-analytics': 'التحليلات', 'side-billing': 'الفواتير', 'side-audit': 'تدقيق الأماكن', 'side-docs': 'التوثيق', 'side-upgrade': 'ترقية الخطة', // Dashboard General 'welcome': 'مرحباً بك مجدداً', 'system-status': 'النظام يعمل بكفاءة', 'quota-card-title': 'رصيد الاستهلاك', 'requests-left': 'طلب متبقي', 'used-label': 'مستهلك', // KPI Labels 'kpi-total-req': 'إجمالي الطلبات', 'kpi-success-rate': 'نسبة النجاح', 'kpi-active-keys': 'المفاتيح النشطة', 'kpi-latency': 'متوسط سرعة الاستجابة', } }, init: () => { i18n.apply(i18n.currentLang); }, toggle: () => { const nextLang = i18n.currentLang === 'en' ? 'ar' : 'en'; i18n.currentLang = nextLang; localStorage.setItem('intaleq_lang', nextLang); i18n.apply(nextLang); }, apply: (lang) => { const rtl = lang === 'ar'; document.documentElement.dir = rtl ? 'rtl' : 'ltr'; document.documentElement.lang = lang; // Apply font classes if (rtl) { document.body.style.fontFamily = "'Cairo', sans-serif"; document.body.classList.add('rtl-mode'); } else { document.body.style.fontFamily = "'Plus Jakarta Sans', sans-serif"; document.body.classList.remove('rtl-mode'); } // Mirror Sidebar if in dashboard const sidebar = document.getElementById('main-sidebar'); if (sidebar) { if (rtl) { sidebar.classList.add('order-last', 'border-l', 'border-r-0'); sidebar.classList.remove('border-r'); } else { sidebar.classList.remove('order-last', 'border-l'); sidebar.classList.add('border-r'); } } // Translate elements with data-i18n attribute document.querySelectorAll('[data-i18n]').forEach(el => { const key = el.getAttribute('data-i18n'); const translation = i18n.translations[lang][key]; if (translation) { if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA') { el.placeholder = translation; } else { el.innerHTML = translation; } } }); // Trigger icon re-render if lucide is present if (window.lucide) lucide.createIcons(); } }; // Initialize on load document.addEventListener('DOMContentLoaded', i18n.init);