cardinal

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 translations

Translate in the .po file:

locale/de.po
msgid "Book"
msgstr "Buch"

Translate in code

WhereCall
ElixirCardinal.I18n.t(ctx, "Book {0} is out of stock", [name])
Elixir, with a contextCardinal.I18n.tc(ctx, "Book", "Title")
Vue and TypeScriptt 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:

crm/locale/en.po
msgid "CRM Call Log"
msgstr "Call Log"

msgid "FCRM Settings"
msgstr "CRM Settings"

A site's own Translation records override an app's catalog.

On this page