Skip to the article

CloselineLanguages

Languages

How Closeline runs in English and Arabic, right to left included, 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 its own Arabic typefaces, and figures and dates stay in Latin digits in both languages. Money is always shown in US dollars.

AppEnglishArabic
Website/en/…/ar/…
CRM dashboard/en/…/ar/…
APIAccept-Language: enAccept-Language: ar

English is the default. Deal names, stage names, activity titles and role names are stored in both languages, as { en, ar }; one typed in a single language is kept under both until it is given its translation. The seed fills in the Arabic for the whole sample workspace.

How the language is chosen

  • The language is the first part of the address. A path without one goes to /en, or on the dashboard to the language the reader chose last.
  • The language switcher swaps that part of the address and keeps the page. In the dashboard, the Preferences tab of Settings keeps it on the account.
  • The direction is set on the page before the first paint, so an Arabic page never flashes left to right.
  • Both frontends send the page's language to the API, so its messages come back in the same language. The website's hand-overs to the dashboard keep the language too.

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.

AppNamespaces
Websiteblog, contact, demo, errors, home, layout, legal, pricing, sampleData
CRM dashboardai-assistant, auth, common, dashboard (with a folder per page: activities, billing, contacts, deals, overview, pipeline, projects, reports, roles, settings, team, users and more), invitation, layouts, metadata
  • A key missing from ar.json shows 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.
  • The dashboard's sidebar labels are messages too, under nav.items in messages/layouts/en.json and ar.json, and its browser tab titles are in messages/metadata/.
  • Validation messages come from the same files: every form builds its rules from the translated messages.

What the API translates

  • When the API has a sentence for an error (a refused sign-in, too many attempts, sign-ups closed, maintenance mode), it comes back in the language of the Accept-Language header. ar-SA counts as Arabic; any language the API does not have falls back to English.
  • Other errors go out as codes such as deal_version_conflict or loss_reason_required, and the dashboard shows its own sentence for each.
  • Its own texts are JSON files in back-end/src/i18n/translations/en/ and ar/, one per area: admin, auth, common, mail, project, roles, settings, tasks, users.
  • The invitation, password-reset and billing emails are in mail, written in the recipient's language: the one their account chose, otherwise the workspace's (for a reset, the language it was asked in), otherwise English. The link inside opens the dashboard in that language.

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 website/.

  1. Add the code to locales in src/i18n/routing.ts and src/config/i18n.ts.
  2. Copy every messages/<namespace>/en.json to a file named after the new code, and translate the values.
  3. If the language is written right to left, extend the direction check in src/app/[locale]/layout.tsx, which only knows ar.
  4. Add the language's name under Common.language.names in each messages/layout/ file, so the switcher can offer it.

Add a language to the dashboard

  1. Add the code to locales in src/config/i18n.ts and src/proxy.ts, and to the language choices in src/components/LanguageSwitcher.tsx and the Preferences tab.
  2. If it is written right to left, add it to RTL_LOCALES in src/app/layout.tsx.
  3. Copy every messages/**/en.json to a file named after the new code, and translate the values.
  4. Records keep an { en, ar } pair, so a third language in the data is a change to the API and its seed as well.

Add a language to the API

The API knows en and ar in back-end/src/i18n/i18n.service.ts, and the account preferences and the password-reset request accept those two. Add the new code there, copy src/i18n/translations/en/ to a folder named after it, and translate the files. Records store an { en, ar } pair, so a third language in the data is a change to those records and the seed.

Stuck on a step?

Find a fix before you start over.

Troubleshooting

Cookie Preferences

We use cookies to enhance your browsing experience, analyze site traffic, and personalize content. By clicking "Accept All", you consent to our use of cookies for analytics and personalized advertising.