|null */ private static ?array $ar_to_en = null; public static function register(): void { // We only intercept when admin locale is English; Arabic users see // the original strings unchanged. add_filter('gettext', [self::class, 'translate'], 5, 3); } /** * @param string $translation * @param string $text * @param string $domain * @return string */ public static function translate($translation, $text, $domain): string { if ($domain !== 'aetos-seo') { return (string) $translation; } if (I18n::lang() !== 'en') { return (string) $translation; } $map = self::map(); return $map[$text] ?? (string) $translation; } /** * @return array */ private static function map(): array { if (self::$ar_to_en !== null) { return self::$ar_to_en; } // Base map: the strings the free build renders — Dashboard, Findings, // Quick-setup Settings, and the Danger zone. Entries for optional admin // sections are appended below and stripped from the free build. $map = [ // Settings page — section headers (shared) 'الإعدادات' => 'Settings', 'إعداد سريع' => 'Quick setup', 'منطقة الخطر' => 'Danger zone', // Settings page — Quick setup hints (shared) 'أهم الإعدادات — اضبطها واضغط حفظ للبدء' => 'Key settings — set them and click Save to start', 'يبعت إيميل HTML بنتيجة الـ Audit + الـ category scores + أهم 8 مشاكل بعد كل run.' => 'Sends an HTML email with audit results, category scores, and top 8 issues after every run.', 'فاضي = admin email المسجّل في WordPress' => 'Empty = WordPress admin email', 'سرعة الزحف (مللي ثانية)' => 'Crawl delay (milliseconds)', 'الوقت بين كل دفعة. 1500 مناسب للاستضافة المشتركة. قلّله للسيرفرات القوية.' => 'Time between batches. 1500 fits shared hosting. Lower it for stronger servers.', 'لغة لوحة الإضافة' => 'Admin panel language', 'Auto = حسب لغة WordPress. Arabic / English = إجبار لغة معينة بغض النظر عن إعداد الموقع.' => 'Auto = follow WordPress locale. Arabic / English = force one regardless of site setting.', // Buttons (shared) 'حفظ الإعدادات' => 'Save Settings', 'مسح كل البيانات' => 'Clear all data', 'يمسح كل نتائج الفحص والزحف والتقارير. الإعدادات لن تتأثر. هذا الإجراء لا يمكن التراجع عنه.' => 'Wipes all scan, crawl, and report data. Settings remain intact. This action cannot be undone.', // Findings page — filter buttons + labels 'تصفية' => 'Filter', 'الكل' => 'All', 'المفتوحة' => 'Open', 'عالية الخطورة' => 'High severity', 'مفتوحة + عالية' => 'Open + High', 'عرض التفاصيل' => 'View details', 'تم الحل' => 'Mark done', 'تجاهل' => 'Ignore', 'إعادة فحص' => 'Retest', 'الأولويات العاجلة (أهم 5 مشاكل مفتوحة)' => 'Top priority (5 most urgent open issues)', 'هذه أبرز المشاكل التي تحتاج تدخلاً الآن — ابدأ بـ High ثم Med.' => 'These are the open issues that need attention now — start with High, then Medium.', 'لا توجد نتائج' => 'No findings', 'النتائج' => 'Findings', // Findings page — filter form labels + search 'رقم الفحص' => 'Run ID', 'الفئة' => 'Category', 'كل الفئات' => 'All categories', 'الأولوية' => 'Severity', 'الحالة' => 'Status', 'بحث سريع' => 'Quick search', 'اكتب للفلترة في الصفحة الحالية...' => 'Type to filter on this page...', // Dashboard (shared) 'لوحة التحكم' => 'Dashboard', 'تشغيل فحص جديد' => 'Run new audit', 'استئناف' => 'Resume', 'فحص قيد التشغيل' => 'Audit running', 'النقاط' => 'Score', // v4.0.3 — remaining Dashboard / Settings labels (bilingual completion). 'هذه أبرز المشاكل التي تحتاج تدخلاً الآن. ابدأ بـ High ثم Med.' => 'These are the open issues that need attention now. Start with High, then Medium.', 'عرض كل المشاكل المفتوحة' => 'View all open issues', 'النتيجة الإجمالية' => 'Overall score', 'ممتاز' => 'Excellent', 'متوسط — يحتاج تحسين' => 'Average — needs improvement', 'ضعيف — يحتاج تدخل عاجل' => 'Poor — needs urgent action', 'آخر فحص مكتمل:' => 'Last completed audit:', 'المدة:' => 'Duration:', 'ثانية' => 'seconds', 'نتائج الفئات' => 'Category results', 'الستاك التقني المرصود' => 'Detected tech stack', '%d إضافة/ثيم اتعرف عليهم في الفحص الأخير. الإعدادات الفعلية موجودة في الـ JSON export.' => '%d plugins/themes were detected in the last audit. The actual settings are in the JSON export.', 'التطور (آخر 10 فحوصات)' => 'Trend (last 10 audits)', 'التاريخ' => 'Date', 'النتيجة' => 'Score', 'تم حفظ الإعدادات بنجاح.' => 'Settings saved successfully.', 'فشل حفظ الإعدادات.' => 'Failed to save settings.', 'كامل: يفحص الموقع حسب حدود الزحف والتحليل اللي تحت (اضبطها على 0 لفحص كل الصفحات). سريع: عينة صغيرة من الصفحات لفحص أوّلي سريع.' => 'Full: scans the site within the crawl and analysis limits below (set them to 0 to scan every page). Sample: a small subset of pages for a quick initial check.', 'عدد صفحات التحليل' => 'Analysis page count', 'كم صفحة يحلّلها الفحص بالتفصيل. 0 = كل الصفحات المزحوفة. الافتراضي 50 لفحص أوّل سريع؛ ارفعه لتحليل أعمق.' => 'How many pages the audit analyzes in detail. 0 = all crawled pages. Default is 50 for a quick first audit; raise it for deeper analysis.', // v4.0.3 — Quick-setup labels shared by both editions (were previously // only in the Pro-only section, so the Lite build left them Arabic). 'نوع الفحص' => 'Scan type', 'كامل' => 'Full', 'سريع (عينة)' => 'Sample (quick)', 'حد عدد الصفحات للزحف' => 'Crawl page limit', '0 = بدون حد (يفحص كل الصفحات). للمواقع الكبيرة اكتب 500 أو 1000.' => '0 = unlimited (scan every page). For large sites use 500 or 1000.', ]; self::$ar_to_en = $map; return self::$ar_to_en; } }