Skip to content

feat(i18n): add Arabic translation and RTL layout support - #1

Closed
xntsO wants to merge 5 commits into
mainfrom
feat/i18n-arabic
Closed

xntsO wants to merge 5 commits into
mainfrom
feat/i18n-arabic

Conversation

@xntsO

@xntsO xntsO commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Problem

T3 Code currently has no Arabic UI, and its layouts across web and mobile rely on physical left/right utilities and positioning that break under right-to-left (dir="rtl") directionality. Arabic-speaking users fall back to English on web, mobile, and desktop.

Change

Adds full Arabic (ar, «العربية») localization and RTL layout support across web, mobile, desktop, and shared contracts:

  • Locale wiring & runtime RTL direction (packages/client-runtime, apps/{web,mobile,desktop}):
    • Registers ar («العربية») in packages/client-runtime/src/locales.ts, all three gt.config.json files, desktop/mobile catalog loaders, and Hermes @formatjs/intl-pluralrules ar locale data.
    • Adds "arabic العربية" as a separate plain search term on the web Language settings row (settingsSearch.ts) so the existing English msg() key hash stays untouched across every catalog (same as feat(i18n): add Ukrainian pingdotgg/t3code#38600 / feat(i18n): add Turkish pingdotgg/t3code#38681).
    • Applies document.documentElement.dir = localeDirection(locale) and Base UI <DirectionProvider> on web, and RTL layout direction on mobile.
    • Localizes shared contract error strings in packages/contracts via msg() / errorMessage() so client error surfaces translate consistently.
  • Arabic catalogs (apps/{web,mobile,desktop}/src/i18n/translations/ar.json):
    • Full catalogs matching every key in en.json: web (10,244 keys), mobile (5,189), desktop (125) — 13,169 unique strings total.
    • Uses full 6-form Arabic ICU plurals (zero, one, two, few, many, other), preserves every {placeholder}, ICU select key, and <T> JSX tree shape, and keeps product/provider names, model IDs, commands, paths, and code identifiers in English.
    • Translated against a unified Arabic terminology glossary (e.g., thread → محادثة, branch → فرع, worktree → شجرة عمل, script → نص برمجي, pull request → طلب سحب), cross-checked by a 3-model review council (GPT-6 Astra, Claude Opus 5.5, Gemini 4 Neon), and reviewed by a native Arabic speaker (Faisal), with all disputed entries resolved manually.
  • RTL layout support (apps/web, apps/mobile):
    • Converts physical directional utilities (left/right/ml/mr/pl/pr/text-left/text-right) to logical CSS equivalents (start/end/ms/me/ps/pe/text-start/text-end/inset-inline-*) and mirrors directional icons (rtl:-scale-x-100).
    • Isolates code blocks, diffs, terminal surfaces, file paths, git refs, diff stat counters (+N -M), and the T3 Code wordmark in dir="ltr" so technical content stays readable inside RTL UI.
    • Updates mobile native modules (iOS Swift/Obj-C++ and Android Kotlin) for composer chips, review diff layout, and source text directionality.

Scope

This adds a new locale (ar) along with the RTL layout support required for Arabic to render cleanly, so it is a feature rather than a bug fix and I am not a vouched contributor. Opened the same way as the other community locale PRs (pingdotgg#34720, pingdotgg#38118, pingdotgg#38600, pingdotgg#38681, pingdotgg#39600). I searched open and closed PRs and issues for Arabic and found no Arabic translation PR (only pingdotgg#27019 for inline RTL text direction in specific inputs). apps/marketing is left out of scope for now. Happy to adjust scope or move to a discussion if a maintainer prefers.

Verification

Verified locally on Windows 11 (Node 26.13.1):

  • Catalog & ICU checks: Script-checked every entry across web, mobile, and desktop ar.json against en.json — 0 missing keys, 0 extra keys, 0 ICU/placeholder/rich-text structure errors.
  • Static checks & typecheck: vp run check:changed passed unused patches, format (all changed files), lint (0 warnings, 0 errors), knip (knip:check:files & knip:check:exports), typecheck (42/42 packages), and react compiler coverage (324 files).
  • Tests: 172/174 affected test files passed; targeted reruns on the final RTL fixes (ThreadDetailsCard.browser.test.tsx, DiffPanel.browser.test.tsx) passed 17/17. Two pre-existing Windows-environment failures unrelated to this branch were seen locally (VoiceSettingsPanel.browser.test.tsx under ar-SA OS locale; one sub-pixel scroll tolerance assertion in AttachmentFilePreview.browser.test.tsx).
  • Live web app in Arabic (dir="rtl", lang="ar", Replay provider): Verified live language switching without reload across Settings, Thread with approval (بانتظار الموافقة / العمل جارٍ منذ), Command palette (Ctrl+K), Diff panel, Sidebar (expanded & collapsed), Thread details card, and Snooze menu plurals. Caught and fixed 5 real RTL layout bugs during live inspection (sidebar toggle/logo overlap, top-end panel controls, ThreadDetailsCard insetInlineEnd, +N -M diff counters, and diff ref combobox clipping).
  • Not checked locally: Native iOS/Android builds and lint:mobile (swiftlint/ktlint/detekt unavailable on Windows); macOS Electron traffic-light inset under RTL.
English العربية (RTL)
Settings, English Settings, Arabic RTL
Thread with approval, English Thread with approval, Arabic RTL
Command palette, English Command palette, Arabic RTL
Diff panel, English Diff panel, Arabic RTL
Snooze menu, English Snooze menu, Arabic RTL

Note

Submitted by Gemini 4 Neon (T3 Code, Antigravity harness) on behalf of Faisal (@xntsO). Translation and review council: GPT-6 Astra, Claude Opus 5.5, and Gemini 4 Neon, with final native Arabic review by Faisal.

@xntsO

xntsO commented Nov 21, 2026

Copy link
Copy Markdown
Owner Author

Opened upstream PR: pingdotgg#40286

@xntsO xntsO closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant