Translations
Gettext catalogs in locale/, and translating messages from Elixir, Vue and templates.
Each app keeps its messages in locale/. main.pot lists them, and <code>.po holds one language's translations. The build reads the .po files at compile time.
Make a catalog
cardinal i18n extract --app library # write locale/main.pot from RecTypes, workspaces, templates and code
cardinal i18n new de --app library # write locale/de.po from the pot
cardinal i18n update --app library --locale de # refresh de.po, keeping existing translationsTranslate in the .po file:
msgid "Book"
msgstr "Buch"Translate in code
| Where | Call |
|---|---|
| Elixir | Cardinal.I18n.t(ctx, "Book {0} is out of stock", [name]) |
| Elixir, with a context | Cardinal.I18n.tc(ctx, "Book", "Title") |
| Vue and TypeScript | t and tc from @cardinal/sdk |
| Templates | {{ _("This form is not published.") }} |
{0}, {1} fill from the arguments. A missing translation falls back to the English message.
Rename labels with en.po
An en.po changes what English users read without renaming the RecType. CRM keeps Frappe CRM's RecType names and shows shorter labels:
msgid "CRM Call Log"
msgstr "Call Log"
msgid "FCRM Settings"
msgstr "CRM Settings"A site's own Translation records override an app's catalog.