From 9100973576f87adcadaf6c8b331df7e729aeb117 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 28 Jul 2026 19:03:15 +0200 Subject: i18n: make all UI chrome user-translatable via ui/.ini The interface chrome (version labels, TUI keybar/messages, CLI banner words, web control labels, section-heading words) was English/Polish hardcoded in Go. It is now data: the English and Polish tables ship as embedded lang/en.ini and lang/pl.ini, and any language is user-overridable at /ui/.ini, resolved per key with an English fallback. With ui_language = plus a names/.ini, the WHOLE interface -- chrome, day names, saint names -- is translatable without a rebuild. - i18n.Get loads the embedded English baseline, overlays the embedded/user language file, caches per lang; field <-> INI-key mapping is by reflection (lang.go) so the tables and files stay in sync automatically. Edge-space values (e.g. "error: ") are double-quoted so the INI trim keeps them. The Go tables move to golden_test.go; TestGoldenMatchesEmbedded asserts the embedded files still parse back to them, and TestGenerateLangFiles regenerates them (LECTIO_GEN=1). - config.UIDir(); wire i18n.SetUserDir in the CLI, TUI and web entry points. - README/config: document ui/.ini alongside names/.ini. --- README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index e344de0..3e17a29 100644 --- a/README.md +++ b/README.md @@ -319,13 +319,19 @@ Add your own translation the same way: a tab-separated `.tsv` `name`, `psalm_system`); validate with `lectio --corpus-check `. A version code lectio can't find renders as `(not in )` — it never fails the day. -## Localising day names - -`ui_language` accepts **any** code. It sets the language of the **day and saint -names** in the daily view, independently of the reading text. (The UI chrome — -button labels, keybar — is English or Polish; any other code falls back to -English chrome.) - +## Localising to your language + +`ui_language` accepts **any** code, and *everything visible* is translatable from +plain-text files — no rebuild. Set `ui_language = ` and provide the files +below; each overrides the English baseline key by key, so a partial translation +just leaves the rest in English. The reading text stays in its source language +(that comes from the corpus, not the interface). + +- **Interface chrome** (button labels, keybar, menu words, column headers) lives + in `.ini` in your UI dir (`~/.config/lectio/ui/`). English and Polish ship + built in; use the shipped `internal/i18n/lang/en.ini` as the full key list to + translate (e.g. `bookmarks = Zakładki`, `banner_gospel = Évangile`). Only the + built-in `en`/`pl` need no file. - **Day names** (e.g. "3rd Sunday in Ordinary Time") are generated. English is built in and Polish ships with lectio: `ui_language = pl` → "3. Niedziela Okresu Zwykłego". To add or customise a language, drop a -- cgit v1.3