Languages
How the store 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 its own fonts on the storefront.
| App | English | Arabic |
|---|---|---|
| Storefront | /en/… | /ar/… |
| Admin dashboard | /en/… | /ar/… |
| API | Accept-Language: en | Accept-Language: ar |
English is the default. Products and categories are stored with a name and description in both languages, entered side by side in the dashboard.
How the language is chosen
- The language is the first part of the address. A path without one goes to
/en; the browser's language is not detected. - The language switcher swaps that part of the address and keeps the page.
- On the storefront, the direction is set 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.
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 |
|---|---|
| Storefront | account, auth, cart, checkout, common, home, layouts, seo, store, support, tryon, wishlist |
| Admin dashboard | ai-assistant, auth, common, dashboard (with a folder per page), demo-credentials, layouts |
- A key missing from
ar.jsonshows as a missing-message error on the Arabic side, so keep the two files in step. - The admin's sidebar labels are the exception: they are written in English and Arabic in
src/layouts/dashboard/sidebar/config/navigationData.ts. - Text inside
{curly}braces is filled in by the app, such as{brand}. Keep those words as they are in both languages.
The apps' own Arabic labels
When you write about the store in Arabic, use the labels its screens show:
| English | Arabic | Where |
|---|---|---|
Home | الرئيسية | Storefront menu |
Shop | المتجر | Storefront menu |
Cart | السلة | Storefront |
Checkout | إتمام الشراء | Storefront |
Wishlist | المفضلة | Storefront |
Sign In | تسجيل الدخول | Both apps |
Track Order | تتبع الطلب | Storefront |
Overview | نظرة عامة | Admin sidebar |
AI Assistant | المساعد الذكي | Admin sidebar |
Products | المنتجات | Admin sidebar |
Categories | الفئات | Admin sidebar |
Orders | الطلبات | Admin sidebar |
Users | المستخدمين | Admin sidebar |
Home Page | الصفحة الرئيسية | Admin sidebar |
Admin Management | إدارة المسؤولين | Admin sidebar |
Admin Roles | أدوار المسؤولين | Admin sidebar |
Settings | الإعدادات | Admin sidebar |
Notifications | الإشعارات | Admin top bar |
The roles page and the settings tab call staff المشرفين where the sidebar says المسؤولين. Pick one word and change the other in messages/dashboard/settings/ if the difference matters to you.
What the API translates
- Error messages and the
messageof a successful write come back in the language of theAccept-Languageheader.ar-SAcounts as Arabic; any language the API does not have falls back to English. - Its texts are JSON files in
back-end/src/i18n/translations/en/andar/, one per area:admin,auth,category,common,countries,order,product,project,roles,settings,tasks,users. - Products and categories come back with both languages, as
{ "en": "…", "ar": "…" }, and the frontend picks one.
Add a language to the storefront
The two languages are written into several files, so adding a third touches each of them. Paths are inside storefront/.
Add the language code
Add it to the locale lists in
src/config/i18n.ts,src/proxy.ts,src/app/[locale]/layout.tsxandsrc/components/LanguageSwitcher.tsx, and tosrc/lib/seo/ogLocales.ts.Translate the messages
Copy
en.jsonto<code>.jsonin each of the 12 folders undermessages/and translate the values.Set the direction
For a right-to-left language, add it to
RTL_LOCALESinsrc/app/layout.tsxand tosrc/hooks/locale/useDirection.ts.Widen the brand and manifest
src/config/brand.config.tsandsrc/app/[locale]/manifest.tshold anenand anarvalue per text: add yours. Searchsrc/features/for"en" | "ar"and widen those types too.Add a font for its script
If the language needs letters the shipped fonts lack, add a font to the Google Fonts link in
src/app/layout.tsxand use it insrc/styles/base.css.
Products and categories are stored in English and Arabic only. A third language also needs the API's catalogue fields and the dashboard's product form to carry it.
Add a language to the admin dashboard
Paths are inside admin-dashboard/.
Add the language code
Add it to the locale lists in
src/config/i18n.ts,src/proxy.ts,src/app/[locale]/layout.tsxandsrc/components/LanguageSwitcher.tsx.Translate the messages
Add a
<code>.jsonbeside everyen.jsonundermessages/, including the folders insidemessages/dashboard/.Translate the sidebar
Add your language to each label in
src/layouts/dashboard/sidebar/config/navigationData.ts, and to the texts insrc/config/brand.config.tsandsrc/app/[locale]/manifest.ts.Set the direction
For a right-to-left language, add it to
src/hooks/locale/useDirection.ts.
Add a language to the API
Add the language code
Add it to
supportedLocalesinback-end/src/i18n/i18n.service.ts.Translate the messages
Copy
back-end/src/i18n/translations/en/to a folder named after the code and translate the values. A key you leave out falls back to English.