diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 21:51:40 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 21:51:40 +0200 |
| commit | 4c776396115c8120c3e1cb8fda993449fcdcd326 (patch) | |
| tree | 0144fb325663dde063057a5ec568c59d4cbe79da /internal/i18n/i18n.go | |
| parent | bfa8df7b36ccbd44703e0705d51a2ed553a23164 (diff) | |
| download | lectio-4c776396115c8120c3e1cb8fda993449fcdcd326.tar.gz lectio-4c776396115c8120c3e1cb8fda993449fcdcd326.zip | |
i18n: ui_language config (default en) for UI chrome across cli/tui/web; version labels localised
Diffstat (limited to 'internal/i18n/i18n.go')
| -rw-r--r-- | internal/i18n/i18n.go | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/internal/i18n/i18n.go b/internal/i18n/i18n.go new file mode 100644 index 0000000..a5cb77b --- /dev/null +++ b/internal/i18n/i18n.go @@ -0,0 +1,114 @@ +// Package i18n holds lectio's UI-chrome string tables (English and Polish) +// for the ui_language config setting. It localises the chrome only -- +// version-column labels, the TUI keybar/messages, the CLI banner words, the +// web control labels, and the modern-lectionary section-heading label words +// -- never the scripture verse text or citation, which stay source-language. +package i18n + +// UI is one language's complete set of chrome strings. +type UI struct { + // Version names each bible version for column headers / prose, keyed by + // version code (pl, wuj, vul, grb, drb). + Version map[string]string + + // PartLabel names each modern-lectionary section's heading label word, + // keyed by liturgy.Section.PartID (pierwsze_czytanie, psalm, + // drugie_czytanie, aklamacja, ewangelia). The pl entries are the exact + // prefixes niedziela.pl's scraped headings carry, used by + // render.LocalizeHeading to recognise and swap the label word while + // keeping the citation untouched. + PartLabel map[string]string + + // TUI keybar and status messages. + FooterKeys, Loading, NoReadingsFor, ErrorPrefix, ErrorHint string + + // CLI banner label words: the banner is "<word> — <date>". + BannerGospel, BannerReadings string + + // Web control labels. + Lectionary, OptModern, OptTraditional string + Parts, OptGospel, OptAll string + Layout, OptHorizontal, OptColumns string + OptInterlinear, Theme, Mono string +} + +// Get returns lang's chrome string set, falling back to English for +// anything other than "pl". +func Get(lang string) UI { + if lang == "pl" { + return plUI + } + return enUI +} + +var enUI = UI{ + Version: map[string]string{ + "pl": "Polish (niedziela.pl)", + "wuj": "Wujek (Polish)", + "vul": "Vulgate (Latin)", + "grb": "Greek", + "drb": "Douay-Rheims (English)", + }, + PartLabel: map[string]string{ + "pierwsze_czytanie": "1st reading", + "psalm": "Psalm", + "drugie_czytanie": "2nd reading", + "aklamacja": "Acclamation", + "ewangelia": "Gospel", + }, + FooterKeys: "tab/⇧tab version ←/→ day j/k scroll space/b page g/G top/bottom r refresh q quit", + Loading: "loading…", + NoReadingsFor: "no readings for ", + ErrorPrefix: "error: ", + ErrorHint: "change date (←/→) or refresh (r)", + BannerGospel: "Gospel", + BannerReadings: "Readings", + Lectionary: "lectionary", + OptModern: "modern", + OptTraditional: "traditional", + Parts: "parts", + OptGospel: "Gospel", + OptAll: "all parts", + Layout: "layout", + OptHorizontal: "horizontal", + OptColumns: "columns", + OptInterlinear: "interlinear", + Theme: "theme", + Mono: "mono", +} + +var plUI = UI{ + Version: map[string]string{ + "pl": "Polski (niedziela.pl)", + "wuj": "Wujek (pol.)", + "vul": "Wulgata (lac.)", + "grb": "Grecki", + "drb": "Douay-Rheims (ang.)", + }, + PartLabel: map[string]string{ + "pierwsze_czytanie": "1. czytanie", + "psalm": "Psalm", + "drugie_czytanie": "2. czytanie", + "aklamacja": "Aklamacja", + "ewangelia": "Ewangelia", + }, + FooterKeys: "tab/⇧tab wersja ←/→ dzień j/k przewiń spacja/b strona g/G góra/dół r odśwież q wyjście", + Loading: "ładowanie…", + NoReadingsFor: "brak czytań na ", + ErrorPrefix: "błąd: ", + ErrorHint: "zmień datę (←/→) lub odśwież (r)", + BannerGospel: "Ewangelia", + BannerReadings: "Czytania", + Lectionary: "lekcjonarz", + OptModern: "nowy", + OptTraditional: "tradycyjny", + Parts: "zakres", + OptGospel: "Ewangelia", + OptAll: "wszystkie części", + Layout: "układ", + OptHorizontal: "poziomo", + OptColumns: "kolumny", + OptInterlinear: "interlinearnie", + Theme: "motyw", + Mono: "mono", +} |
