Languages
How the agency runs in English and Arabic, how to change any text, and what to change to add a language.
For the Full Stack package
The languages that ship
English and Arabic, in all three apps. Arabic lays the whole interface out right to left, with Arabic faces for the text and the headings, and figures and prices stay in Latin digits in both languages.
| App | English | Arabic |
|---|---|---|
| Public website | /en/… | /ar/… |
| Agency dashboard | /en/… | /ar/… |
| API | Accept-Language: en | Accept-Language: ar |
English is the default. A property's title, short description, description, city and SEO texts, and a neighborhood's name and description, are stored in both languages and entered side by side in the dashboard; English is required, and the Arabic can follow later. The seed fills in the Arabic for the demo agency.
How the language is chosen
- The language is the first part of the address. A path without one goes to
/en(the dashboard's root goes to/en/dashboard). - The language menu swaps that part of the address and keeps the page.
- Both frontends send the page's language to the API, so its messages come back in the same language.
Change a text
Every visible word lives in messages/<namespace>/en.json and ar.json, in each frontend's folder. Change the value, keep the key, and change it in both files.
| App | Namespaces |
|---|---|
| Public website | agency, amenities, common, compare, contact, home, layouts, privacy, properties, property, saved, viewing |
| Agency dashboard | ai-assistant, auth, common, dashboard (with a folder per page: domain, leads, overview, properties, property-editor, settings, studio, viewings), demo-credentials, layouts |
- A key missing from
ar.jsonshows as a missing message on the Arabic side, so keep the two files in step. - Text inside
{curly}braces is filled in by the app, such as{count}or{name}. Keep those words as they are in both languages. - Amenity, property type and status labels are messages too:
messages/amenitieson the website,messages/dashboard/domainin the dashboard.
What the API translates
- Error messages and the
messageof a successful write come back in the language of theAccept-Languageheader.ar-AEcounts as Arabic; any language the API does not have falls back to English. - Its own texts are JSON files in
back-end/src/i18n/translations/en/andar/, one per area:admin,auth,common,lead,neighborhood,property,roles,settings,viewing. - Properties and neighborhoods come back with both languages, as
{ "en": "…", "ar": "…" }, and the frontend picks one.
Add a language to the website
The two languages are written into a few files, so adding a third touches each of them. Paths are inside storefront/.
- Add the code to
localesinsrc/config/i18n.tsand insrc/proxy.ts. - Copy every
messages/<namespace>/en.jsonto a file named after the new code, and translate the values. - If the language is written right to left, extend
directionOfinsrc/config/i18n.ts, which only knowsar. - Add its texts to
nameanddescriptioninsrc/config/brand.config.ts. - Code that picks a stored text by language, such as
src/lib/utils/pickLocalized.ts, the date and time formatting of the viewing request and the calendar, chooses betweenenandar. Searchsrc/for"ar"and handle the new code there too.
Add a language to the dashboard
- Add the code to
localesinsrc/config/locales.ts(and toRTL_LOCALESif it is written right to left) and insrc/proxy.ts. A locale added there also adds its tab to every field kept in several languages. - Copy every
messages/**/en.jsonto a file named after the new code, and translate the values. - Search
src/for"ar"for the few places that still name the two languages directly. - A third language in the stored texts also needs the API to accept it.
Add a language to the API
The API knows en and ar in back-end/src/i18n/i18n.service.ts. Add the new code there, copy src/i18n/translations/en/ to a folder named after it, and translate the files. Stored texts are an { en, ar } pair, validated by src/common/dto/localized.dto.ts, so a third language in the data is a change to those classes, the entities and the seed.