Translating Mailsink
The web UI is localized with Lingui. English (en) is the source
locale; French (fr) is maintained by the core team. Other languages are welcome.
What is translated: every string a person reads in the web UI. What is not translated: API, SMTP and MCP responses, logs, and error codes. They stay in English so they match the providers Mailsink emulates and stay stable for tests.
Where the strings live
Section titled “Where the strings live”apps/mailsink/src/locales/├── en/messages.po # source, generated from the code└── fr/messages.poCatalogs are PO files: one msgid (the
English source or an explicit id) and one msgstr (the translation) per entry, with the
source file as a comment (no line numbers, so unrelated edits do not churn the catalogs).
The configuration is lingui.config.ts at the repository root. The commands run from
anywhere in the repository:
| Command | What it does |
|---|---|
pnpm i18n:extract |
Scans apps/mailsink/src, adds new strings to every catalog, removes obsolete ones. |
pnpm i18n:check |
Fails if a catalog is out of sync with the code, or if the EN or FR catalog has an empty msgstr (what CI runs). Other languages never fail it. |
pnpm i18n:compile |
Compiles the catalogs to JS (--strict). Optional: the Vite plugin compiles PO files itself in pnpm dev and pnpm build. |
The UI language is the one chosen in the language selector (stored in the
mailsink_locale cookie), else the best match of the browser Accept-Language header,
else English. It is resolved on the server, so the page arrives already translated.
Fix an existing translation
Section titled “Fix an existing translation”- Find the entry in
apps/mailsink/src/locales/<lang>/messages.po. - Change only the
msgstr. Never editmsgid: it is generated from the code. - Keep placeholders as they are (
{count},{name},<0>…</0>), in any order your language needs. - Run
pnpm i18n:check, then open a pull request titledfix(i18n): corrige la traduction <lang> de <écran>(English titles are fine too).
Add a language
Section titled “Add a language”- Open an issue with the « Translation » template to announce it (avoids duplicate work).
- Add the locale code (BCP 47, e.g.
de,pt-BR) tolocalesinlingui.config.tsand toLOCALESandLOCALE_LABELS(the language name in that language) inapps/mailsink/src/i18n/locales.ts. - Run
pnpm i18n:extract: it createsapps/mailsink/src/locales/<lang>/messages.po. - Translate every entry. Plurals use ICU syntax:
{count, plural, one {# message} other {# messages}}; add the categories your language needs (few,many…). - Run
pnpm i18n:check(catalogs in sync), thenpnpm exec lingui check missing --mode catalog --locale <lang>(no emptymsgstrleft:i18n:checkonly requires EN and FR to be complete), and look at the UI withpnpm dev, switching language with the language selector. - Open a pull request
feat(i18n): ajoute la langue <lang>, linking the issue. Add a screenshot of a couple of screens if you can.
A new language is merged when it is complete. Later UI changes add English strings to
every catalog (pnpm i18n:extract) but only EN and FR must be filled in the same pull
request: missing entries of other languages fall back to English (fallbackLocales in
lingui.config.ts) until they are translated, and maintainers ping the language
contributors on the pull request.
Writing guidelines
Section titled “Writing guidelines”- Short, plain, neutral. Product terms stay as is: Mailsink, workspace, webhook, override, SMTP, API key. Translate them only if your language has a settled equivalent (French keeps « workspace » and « webhook »).
- Keep the meaning of status names (
delivered,hard_bounce…) consistent with the API value shown next to them. - No em dash. Follow your language’s typography (French: non-breaking space before
: ; ? !).
For developers adding UI strings
Section titled “For developers adding UI strings”- Wrap every user-facing string with the Lingui macros:
<Trans>…</Trans>orconst { t } = useLingui()thent`Delete workspace`, both from@lingui/react/macro. Use an explicit id and acommentwhen the English text is ambiguous. Never use the globali18nfrom@lingui/core: the active instance is per request (SSR) and comes fromI18nProviderinapps/mailsink/src/routes/__root.tsx. - API, SMTP and MCP messages are never wrapped (D19).
- Run
pnpm i18n:extractand fill the French entries in the same pull request. CI rejects a pull request whose FR or EN catalog is incomplete, or whose catalogs (any language) are out of sync with the code.