solidcraft-ui-text
UI text and translations
SolidCraft embeds its translations and works offline. The long form is docs/localization.md.
Adding a message
- Add the id and English text in a new pending file (next section);
assets/locales/en.jsonitself is only edited to change an existing message. Ids are stable: keep them when you change wording. - Use
app.tr("ui.some_id")for static messages andLocale::formatfor whole sentences with named placeholders. Translate the whole sentence, punctuation included, so a translator can reorder arguments. Use stable ids directly for new messages, not the English-label adapter (app.tr_label), which exists for older tables. - Command labels live under
cmd.<command id>;cargo xtask i18n --add-missingwrites the ones that are missing intoen.json. - Add the UK spelling to
assets/locales/en-GB.jsonwhen the US spelling differs (Centre, Colour, Licence, ...). That file holds only the differing messages. - A new label needs
en,ja,zh,deandko. The other catalogs are partial and fall back to English;cargo xtask i18nreports their gaps without failing, andevery_complete_catalog_carries_every_english_messagefails a missingjaorzhentry. - Run
cargo xtask lists --fixbefore committing, thencargo xtask i18n.
Sorted catalogs
Catalogs are one message per line, sorted by id, with no repeated id. cargo xtask lists (part of cargo xtask ci and the Lists workflow) fails on an unsorted file. Catalogs are no longer edited for new messages (see Pending locale files); for an edit, let --fix place it. Two PRs that add neighbouring keys still collide on these files; rebase and run --fix again.
Pending locale files
New strings go in a new assets/locales/pending/<slug>.json (lowercase, dashes, named after the change), never into the catalogs. It maps a locale code to {"message id": "text"}: give English and any other locale you can translate; a locale you leave out falls back to English. The id must not already be in that locale's catalog or in another pending file (the build and cargo xtask lists fail otherwise); to change an existing message, edit the catalog. Do not sort or fold: the app, cargo xtask i18n and the tests read pending files as part of the catalogs. After a merge, the Generated files workflow runs cargo xtask fold-pending on main; never run it in a PR. New ATTRIBUTION.md rows likewise go in a new attribution/pending/<slug>.md, never into the table. Each folder's README has the details.