diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-03 23:34:22 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-03 23:34:22 +0200 |
| commit | da1818a73de736dffd1580137352c32bea81be8c (patch) | |
| tree | 3f17a87077189fe92641b60fbd124c9287c2dfe5 /internal/i18n | |
| parent | d45d0b4e4534253d782cc6312d7edda43cca196d (diff) | |
| download | lectio-da1818a73de736dffd1580137352c32bea81be8c.tar.gz lectio-da1818a73de736dffd1580137352c32bea81be8c.zip | |
i18n: rank and colour vocabulary tables
Diffstat (limited to 'internal/i18n')
| -rw-r--r-- | internal/i18n/golden_test.go | 23 | ||||
| -rw-r--r-- | internal/i18n/i18n.go | 17 | ||||
| -rw-r--r-- | internal/i18n/lang/en.ini | 16 | ||||
| -rw-r--r-- | internal/i18n/lang/pl.ini | 16 | ||||
| -rw-r--r-- | internal/i18n/vocab_test.go | 54 |
5 files changed, 124 insertions, 2 deletions
diff --git a/internal/i18n/golden_test.go b/internal/i18n/golden_test.go index 5a29097..b3ad125 100644 --- a/internal/i18n/golden_test.go +++ b/internal/i18n/golden_test.go @@ -23,6 +23,17 @@ var enUI = UI{ "aklamacja": "Acclamation", "ewangelia": "Gospel", }, + Rank: map[string]string{ + "solemnity": "solemnity", "feast": "feast", "memorial": "memorial", + "optional": "optional memorial", "ferial": "feria", + "class-1": "I class", "class-2": "II class", + "class-3": "III class", "class-4": "IV class", + "commemoration": "commemoration", + }, + Colour: map[string]string{ + "white": "white", "red": "red", "green": "green", + "violet": "violet", "rose": "rose", "black": "black", + }, FooterKeys: "tab/⇧tab version ←/→ day d date j/k scroll space/b page g/G top/bottom q quit", Loading: "loading…", NoReadingsFor: "no readings for ", @@ -111,6 +122,18 @@ var plUI = UI{ "aklamacja": "Aklamacja", "ewangelia": "Ewangelia", }, + Rank: map[string]string{ + "solemnity": "uroczystość", "feast": "święto", + "memorial": "wspomnienie obowiązkowe", "optional": "wspomnienie dowolne", + "ferial": "dzień powszedni", + "class-1": "I klasy", "class-2": "II klasy", + "class-3": "III klasy", "class-4": "IV klasy", + "commemoration": "komemoracja", + }, + Colour: map[string]string{ + "white": "biały", "red": "czerwony", "green": "zielony", + "violet": "fioletowy", "rose": "różowy", "black": "czarny", + }, FooterKeys: "tab/⇧tab wersja ←/→ dzień d data j/k przewiń spacja/b strona g/G góra/dół q wyjście", Loading: "ładowanie…", NoReadingsFor: "brak czytań na ", diff --git a/internal/i18n/i18n.go b/internal/i18n/i18n.go index fece4a8..3928da8 100644 --- a/internal/i18n/i18n.go +++ b/internal/i18n/i18n.go @@ -15,14 +15,27 @@ type UI struct { // version code (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, + // PartLabel names each lectionary section's heading label word, keyed by + // liturgy.Section.PartID -- the modern IDs (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 + // Rank names each liturgical rank, keyed by the string form of + // calendar.Rank. Two vocabularies share the map: the Ordinary Form's + // ferial/optional/memorial/feast/solemnity and the 1962 form's + // class-1..class-4/commemoration. Rendered by the CLI's day header and + // by the dlectio app's day banner and calendar rows. + Rank map[string]string + + // Colour names each normalized liturgical colour, keyed by the string form + // of calendar.Colour (white, red, green, violet, rose, black). Rendered by + // the CLI's day header only -- the dlectio app draws a coloured swatch + // instead and deliberately shows no colour word. + Colour map[string]string + // TUI keybar and status messages. NoReadingsFor and ErrorPrefix each // carry their own single trailing space (the TUI concatenates a date or // error string directly onto them, no separator added at the call site). diff --git a/internal/i18n/lang/en.ini b/internal/i18n/lang/en.ini index 8444a4d..12adf7c 100644 --- a/internal/i18n/lang/en.ini +++ b/internal/i18n/lang/en.ini @@ -7,6 +7,22 @@ part_label.drugie_czytanie = 2nd reading part_label.ewangelia = Gospel part_label.pierwsze_czytanie = 1st reading part_label.psalm = Psalm +rank.class-1 = I class +rank.class-2 = II class +rank.class-3 = III class +rank.class-4 = IV class +rank.commemoration = commemoration +rank.feast = feast +rank.ferial = feria +rank.memorial = memorial +rank.optional = optional memorial +rank.solemnity = solemnity +colour.black = black +colour.green = green +colour.red = red +colour.rose = rose +colour.violet = violet +colour.white = white footer_keys = tab/⇧tab version ←/→ day d date j/k scroll space/b page g/G top/bottom q quit loading = loading… no_readings_for = "no readings for " diff --git a/internal/i18n/lang/pl.ini b/internal/i18n/lang/pl.ini index 305c4c9..3521718 100644 --- a/internal/i18n/lang/pl.ini +++ b/internal/i18n/lang/pl.ini @@ -7,6 +7,22 @@ part_label.drugie_czytanie = 2. czytanie part_label.ewangelia = Ewangelia part_label.pierwsze_czytanie = 1. czytanie part_label.psalm = Psalm +rank.class-1 = I klasy +rank.class-2 = II klasy +rank.class-3 = III klasy +rank.class-4 = IV klasy +rank.commemoration = komemoracja +rank.feast = święto +rank.ferial = dzień powszedni +rank.memorial = wspomnienie obowiązkowe +rank.optional = wspomnienie dowolne +rank.solemnity = uroczystość +colour.black = czarny +colour.green = zielony +colour.red = czerwony +colour.rose = różowy +colour.violet = fioletowy +colour.white = biały footer_keys = tab/⇧tab wersja ←/→ dzień d data j/k przewiń spacja/b strona g/G góra/dół q wyjście loading = ładowanie… no_readings_for = "brak czytań na " diff --git a/internal/i18n/vocab_test.go b/internal/i18n/vocab_test.go new file mode 100644 index 0000000..73115bb --- /dev/null +++ b/internal/i18n/vocab_test.go @@ -0,0 +1,54 @@ +package i18n + +import ( + "testing" + + "github.com/lukaszkasprzak/lectio/internal/calendar" +) + +// Every rank and colour the calendar can emit must have a word in every shipped +// language. This is the guard against adding a constant later and silently +// rendering a raw key like "class-2" in the UI. +func TestVocabularyCoversEveryConstant(t *testing.T) { + ranks := []calendar.Rank{ + calendar.RankFerial, calendar.RankOptional, calendar.RankMemorial, + calendar.RankFeast, calendar.RankSolemnity, + calendar.RankClass1, calendar.RankClass2, calendar.RankClass3, + calendar.RankClass4, calendar.RankCommemoration, + } + colours := []calendar.Colour{ + calendar.White, calendar.Red, calendar.Green, + calendar.Violet, calendar.Rose, calendar.Black, + } + for _, lang := range []string{"en", "pl"} { + ui := Get(lang) + for _, r := range ranks { + if ui.Rank[string(r)] == "" { + t.Errorf("%s: no rank word for %q", lang, r) + } + } + for _, c := range colours { + if ui.Colour[string(c)] == "" { + t.Errorf("%s: no colour word for %q", lang, c) + } + } + } +} + +// The English rank words must not change: lectio's CLI has printed these since +// before the table existed, and English users' output should be untouched. +func TestEnglishRankWordingUnchanged(t *testing.T) { + want := map[string]string{ + "solemnity": "solemnity", "feast": "feast", "memorial": "memorial", + "optional": "optional memorial", "ferial": "feria", + "class-1": "I class", "class-2": "II class", + "class-3": "III class", "class-4": "IV class", + "commemoration": "commemoration", + } + ui := Get("en") + for k, v := range want { + if got := ui.Rank[k]; got != v { + t.Errorf("rank[%q] = %q, want %q", k, got, v) + } + } +} |
