Skip to content

Feature request: Arabic (ar) locale with full RTL support #59

Description

@muhammadALI-14

Feature request: Arabic (ar) locale with full RTL support

Arabic summary / ملخص بالعربية

التطبيق يدعم حالياً English و zh-CN فقط عبر نظام التدويل الموجود (lib/i18n). هذا الطلب يضيف حزمة لغة عربية كاملة (أكثر من 640 مفتاح ترجمة مطابقة لمفاتيح en.ts) مع دعم كامل لاتجاه RTL (من اليمين إلى اليسار)، وقد جهّزت واختُبرت على ويندوز (Edge/WebView2 + متصفح).

Proposed scope

  1. New locale file: lib/i18n/messages/ar.ts — full professional Arabic translation mirroring every key in en.ts (642 keys), preserving {placeholder} interpolation.
  2. Registry/type plumbing (additive, small):
    • lib/i18n/types.ts: Locale = "en" | "zh-CN" | "ar"
    • lib/i18n/registry.ts: register arLocale + browser-locale resolution for ar*
    • hooks/useI18n.tsx: accept stored "ar", and set document.documentElement.dir = rtl for Arabic (ltr otherwise)
  3. RTL support:
    • app/rtl.css (new layer imported after native-theme.css): Arabic font stack (Segoe UI / Tahoma / Noto Sans Arabic), mirrored drawer animations, segmented-control thumb flip, plaintext bidi for chat/markdown, LTR isolation for pre/code/terminal/diff/mermaid, RTL-safe form fields.
    • Converted physical CSS properties (margin/padding/border-left/right, left/right, text-align) in app/globals.css + app/native-theme.css to logical equivalents (-inline-start/end) so the whole chrome mirrors automatically and stays identical in LTR.
    • Language choice is remembered (existing pi-locale pref) and the existing Settings language picker lists the new locale automatically (registry-driven).
  4. Minor string fixes: several raw English strings (aria-labels, headers, placeholders in Models/Plugins/Skills/TabBar/window controls) routed through i18n with keys added to both en.ts and ar.ts.

Notes for maintainers

  • The changes are additive and only active when dir="rtl"; the English/zh-CN UI is unchanged.
  • Branding / fork-ownership rules and tests are untouched.
  • Happy to open a Pull Request with this work if the maintainers are interested.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions