Sufra ships in Arabic (default, right to left) and English. Every page has its language in the address (/ar/menu, /en/menu) and a switch in the header and the dashboard menu. Visiting / opens Arabic.
Interface texts
Every button, label, message and error is in messages/ar.json and messages/en.json, with the same keys. For example:
"checkout": {
"title": "Checkout",
"place": "Place order · {total}"
}
Edit the text, keep the key and the {placeholders}. The two files must have the same keys: a missing key shows the key name on the page.
Restaurant content
Content entered in the dashboard is stored in both languages, in pairs of database columns: nameAr / nameEn, descAr / descEn for categories, dishes and options, and taglineAr / taglineEn, addressAr / addressEn in the settings. The dashboard forms show both fields side by side.
Orders keep a copy of the dish names in both languages, so changing the menu later never changes past orders.
Right to left
The page direction comes from the language (dir="rtl" for Arabic, in src/app/[locale]/layout.tsx). Components use logical spacing (ms-, me-, ps-, start-, end-), so layouts mirror automatically. Phone numbers, codes and prices are marked dir="ltr" so they read correctly inside Arabic text, and numbers use Latin digits in both languages.
Default language
Change defaultLocale in src/i18n/routing.ts:
export const routing = defineRouting({ locales: ["ar", "en"], defaultLocale: "en", localePrefix: "always" });
Adding a language
Adding a third language (for example Urdu or French) touches three places:
src/i18n/routing.ts: add the code tolocales.messages/<code>.json: copyen.jsonand translate it.- The database: add columns for the new language (
nameUr,descUr, ...) inprisma/schema.prisma, runnpx prisma db push, then add the fields to the dashboard forms (src/components/dash/MenuManager.tsx,SettingsForm.tsx). Content is chosen per language by thepick()helper insrc/components/shop/ShopProvider.tsxand, in server pages, by expressions likelocale === "ar" ? d.nameAr : d.nameEn: search the project for=== "ar"and extend each one.
For a right-to-left language, also update isRtl() in src/i18n/routing.ts.