Languages

Arabic and English, right to left and left to right, and adding a language.

How it works

Dar uses next-intl. Every page lives under a language prefix: /ar/... (the default, right to left) and /en/.... Visiting / redirects to /ar. The language switch in the header keeps the current page and its filters.

Where What is translated
messages/ar.json, messages/en.json every interface text, status, amenity, the home and agency page texts
Database columns ...Ar / ...En listing titles and descriptions, addresses, area names and texts, agent names and titles, the agency settings
docs/ar, docs/en this documentation

npm test checks that both message files have exactly the same keys and that every status, type, amenity and place kind has a label.

Writing direction

<html dir> is rtl for Arabic and ltr for English. Layouts use logical properties only (ms-, me-, ps-, start-, end-, text-start), so the whole interface mirrors itself. Arrows and chevrons that point "forward" are swapped in RTL; logos, photos and phone numbers are not mirrored. Phone numbers and email addresses are wrapped in <bdi dir="ltr"> so they read correctly inside Arabic sentences.

Numbers and prices

Arabic pages use Latin digits (ar-OM-u-nu-latn), which is what buyers in Oman read on contracts and advertisements. To use Arabic-Indic digits, change intlLocale in src/lib/format.ts to return "ar-OM".

Arabic plural forms (one, two, few, many) are written out in the message files, for example "{n, plural, one {عقار واحد} two {عقاران} few {# عقارات} many {# عقاراً} other {# عقار}}".

Changing the default language

In src/i18n/routing.ts set defaultLocale: "en".

Adding a language

  1. Add the code to locales in src/i18n/routing.ts and to the matcher in src/proxy.ts (/(ar|en|fr)/dashboard).
  2. Copy messages/en.json to messages/<code>.json and translate it.
  3. The database stores two languages (...Ar and ...En columns). For a third, add columns (for example titleFr) to prisma/schema.prisma, run npx prisma db push, and show them where the pages pick ar ? x.titleAr : x.titleEn.
  4. Add docs/<code>/ if you want the documentation in that language.