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
- Add the code to
localesinsrc/i18n/routing.tsand to the matcher insrc/proxy.ts(/(ar|en|fr)/dashboard). - Copy
messages/en.jsontomessages/<code>.jsonand translate it. - The database stores two languages (
...Arand...Encolumns). For a third, add columns (for exampletitleFr) toprisma/schema.prisma, runnpx prisma db push, and show them where the pages pickar ? x.titleAr : x.titleEn. - Add
docs/<code>/if you want the documentation in that language.