diff options
| -rw-r--r-- | internal/i18n/vocab_test.go | 31 | ||||
| -rw-r--r-- | internal/readings/offline.go | 9 | ||||
| -rw-r--r-- | internal/render/render.go | 8 |
3 files changed, 48 insertions, 0 deletions
diff --git a/internal/i18n/vocab_test.go b/internal/i18n/vocab_test.go index bcd3464..97c09d6 100644 --- a/internal/i18n/vocab_test.go +++ b/internal/i18n/vocab_test.go @@ -65,3 +65,34 @@ func TestPolishRankWordingUnchanged(t *testing.T) { } } } + +// The Polish part labels must be exactly this spelling, diacritics included, +// and no others. This asserts against plUI directly, NOT i18n.Get("pl"): +// Get overlays the embedded English baseline first and then the Polish file +// on top (lang.go's Get), so a label present in English and missing only +// from plUI.PartLabel would resolve through Get("pl") to the identical +// English word rather than "" -- invisible to +// internal/readings/partids_test.go's TestEveryPartIDHasLabels, which only +// checks Get(lang) for non-emptiness. plUI is the unmerged golden source +// with no fallback, so a missing entry is genuinely absent there, which is +// the only way to catch this. The exact key-count check guards against a +// future addition to plUI.PartLabel slipping in unpinned. +func TestPolishPartLabelWordingUnchanged(t *testing.T) { + want := map[string]string{ + "pierwsze_czytanie": "1. czytanie", + "psalm": "Psalm", + "drugie_czytanie": "2. czytanie", + "aklamacja": "Aklamacja", + "ewangelia": "Ewangelia", + "epistola": "Lekcja", + "evangelium": "Ewangelia", + } + if len(plUI.PartLabel) != len(want) { + t.Fatalf("plUI.PartLabel has %d keys, want %d: %v", len(plUI.PartLabel), len(want), plUI.PartLabel) + } + for k, v := range want { + if got, ok := plUI.PartLabel[k]; !ok || got != v { + t.Errorf("plUI.PartLabel[%q] = %q (present=%v), want %q", k, got, ok, v) + } + } +} diff --git a/internal/readings/offline.go b/internal/readings/offline.go index c2c276b..608abd8 100644 --- a/internal/readings/offline.go +++ b/internal/readings/offline.go @@ -84,6 +84,15 @@ func efPartHeading(part, lang string) (id, heading string) { // ofPartOrder and efPartOrder are the display orders of each lectionary's // sections. They are the single source of truth for which part IDs exist. +// +// ofPartOrder's five modern IDs must remain the same *set* as +// internal/render/render.go's modernPartOrder, which lists them in a +// different, deliberate order (prefix-match determinism for +// render.LocalizeHeading, unrelated to display order). Nothing enforces +// that agreement mechanically -- internal/readings and internal/render do +// not import each other (adding a cross-package test would create a new +// dependency edge that does not exist today) -- so if a sixth modern part +// is ever added here, add it to modernPartOrder too, by hand. var ( ofPartOrder = []string{"pierwsze_czytanie", "psalm", "drugie_czytanie", "aklamacja", "ewangelia"} efPartOrder = []string{"epistola", "evangelium"} diff --git a/internal/render/render.go b/internal/render/render.go index c744aac..3437396 100644 --- a/internal/render/render.go +++ b/internal/render/render.go @@ -29,6 +29,14 @@ func versionLabel(version, lang string) string { // than ranging over i18n.UI.PartLabel (a map, so Go randomises its // iteration order). None of the five labels is a prefix of another, so the // order never changes which one matches, only determinism. +// +// Its *set* of five IDs must match internal/readings/offline.go's +// ofPartOrder, which lists the same modern IDs in a different, deliberate +// order (display order, unrelated to this package's prefix-match need). +// Nothing enforces that agreement mechanically -- internal/render and +// internal/readings do not import each other (adding a cross-package test +// would create a new dependency edge that does not exist today) -- so if a +// sixth modern part is ever added to ofPartOrder, add it here too, by hand. var modernPartOrder = []string{"pierwsze_czytanie", "drugie_czytanie", "psalm", "aklamacja", "ewangelia"} // LocalizeHeading swaps a modern (niedziela.pl) section heading's leading |
