Skip to content

feat: add arabic to the shared contact page - #40

Merged
leviFrosty merged 1 commit into
mainfrom
arabic-locale
Oct 15, 2026
Merged

leviFrosty merged 1 commit into
mainfrom
arabic-locale

Conversation

@leviFrosty

Copy link
Copy Markdown
Owner

Summary

WitnessWork is adding Arabic as its first right-to-left language (app PR: leviFrosty/witness-work, the rtl-arabic branch). This is the backend part: the shared-contact page (/c and legacy /c/<payload>) now has Arabic text.

  • contactLinkLocales.ts: adds an ar entry. Like the app, there is one Arabic for every country, so the key has no region. matchLocale now also matches a key that is just the language, so ar, ar-SA and ar-EG (from ?lang= or Accept-Language) resolve to ar.
  • contactLink.ts: right-to-left locales render <html lang="ar" dir="rtl">. Other locales are unchanged. og:locale for Arabic is ar_AR, the code Open Graph uses for Arabic.
  • Tests: Arabic renders on both routes with dir="rtl", plus Accept-Language negotiation for ar, ar-EG and xx, AR-sa;q=0.6.

The app never sends lang on contact links, so the recipient's browser language decides. Without this change, Arabic browsers get the English page. That works, but it's a gap for an Arabic launch.

Verification

  • pnpm vitest run: 56 files, 725 tests passed. pnpm typecheck is clean.
  • verify-ww-api: node scripts/verify/dev.mjs up --persist-to /tmp/ww-verify-arabic, then doctor was all ok. Over HTTP:
    • GET /c with Accept-Language: ar-SA,ar;q=0.9 returned 200 with Content-Language: ar, <html lang="ar" dir="rtl">, <title>افتح جهة الاتصال هذه في WitnessWork</title> and og:locale ar_AR.
    • GET /c with Accept-Language: en-US still returned <html lang="en-us"> (no dir).
  • Not verified: how the page looks in a browser. No headless browser was available on the machine.

Land this on main before the app's Arabic PR ships, per the app's release order (scripts/release-api.sh).

@leviFrosty
leviFrosty merged commit dfcf260 into main Oct 15, 2026
1 check passed
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