# Interface languages Mailflare has 34 interface languages; English is the default. This page lists them and shows contributors how to add one. ## Change language Choose it on the homepage or sign-in page, or under **Settings → Account → General**. The choice applies at once and is saved in a browser cookie for one year. All accounts in that browser share it. Without cookies it lasts until reload. Other open tabs update only after reload. ## Add a language You need a source checkout. 1. Copy the English file, using the language code (BCP 47): ```bash cp src/lib/i18n/en.json public/locales/.json ``` 2. Translate the values. Keep the keys. 3. Register it in `src/lib/i18n/locales.ts`, with its native name: ```ts // Inside locales: es: { label: "Español" }, ``` For right-to-left languages, add `dir: "rtl"`. 4. Test: ```bash node --test tests/i18n.test.mjs npm run lint npx tsc --noEmit ``` No other code changes are needed. ## Translate in code | Where | Use | | --- | --- | | Client components | `useLanguage().t(key, vars?)` | | Server code | `createTranslator(locale)` from `src/lib/i18n/utils.ts` | - Insert values with `{name}`. - Plurals: add `key.one`, `key.other` (and others such as `few`), then call `t("key", { count })`. - New keys go in `en.json` and all other catalogs together. A missing key falls back to English. - Never translate routes, storage keys, permission checks, API values or user content. - Replace text in small steps, not the whole app at once. ## How it works - Catalogs are flat JSON. English is bundled; others load from `/locales/.json`, so they do not count toward the Worker's 3 MiB Free-plan limit. - The root layout reads the `mailflare-locale` cookie (`Path=/`, `SameSite=Lax`, `Secure` on HTTPS), so pages render per request. Unknown values fall back to English. - Date and time formats are not translated. ## Supported languages | Region | Languages (code) | | --- | --- | | Europe | English (`en`), Español (`es`), Français (`fr`), Deutsch (`de`), Italiano (`it`), Nederlands (`nl`), Polski (`pl`), Українська (`uk`), Русский (`ru`), Türkçe (`tr`), Português (Brasil) (`pt-BR`), Português (Portugal) (`pt-PT`) | | South Asia | हिन्दी (`hi`), বাংলা (`bn`), मराठी (`mr`), తెలుగు (`te`), தமிழ் (`ta`), ગુજરાતી (`gu`), ಕನ್ನಡ (`kn`), മലയാളം (`ml`), ਪੰਜਾਬੀ (`pa`), සිංහල (`si`), اردو (`ur`, right-to-left) | | Middle East | العربية (`ar`, right-to-left), فارسی (`fa`, right-to-left) | | East and Southeast Asia | 中文(简体)(`zh-CN`), 日本語 (`ja`), 한국어 (`ko`), Bahasa Indonesia (`id`), Bahasa Melayu (`ms`), Tiếng Việt (`vi`), ไทย (`th`) | | Africa | Kiswahili (`sw`), Hausa (`ha`) | Newer languages have not been reviewed by native speakers. Fixes are welcome as pull requests. ## Troubleshooting | Problem | Cause | Fix | | --- | --- | --- | | Language resets | Cookies blocked | Allow cookies | | Test fails | Missing keys | Add every English key | | Text stays English | Key not translated | Add it to the catalog |