aboutsummaryrefslogtreecommitdiff
path: root/internal/calendar/names_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 18:15:29 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 18:15:29 +0200
commit539a7c71b60115144959f712ef5966f48c63f9f0 (patch)
tree0f07fe348a3a6c99d5a8713e39dd99640aa6efd9 /internal/calendar/names_test.go
parent5e1664b8008675177a551aff1de371f54d4e20e4 (diff)
downloadlectio-539a7c71b60115144959f712ef5966f48c63f9f0.tar.gz
lectio-539a7c71b60115144959f712ef5966f48c63f9f0.zip
naming: localise liturgical day names in any language
Add internal/naming, which renders temporal day names and celebration display names from the calendar engine's slugs in any language. English is the built-in baseline; a language is data -- an embedded lang/<code>.ini (pl shipped) and/or a user file at <config dir>/names/<code>.ini that overrides it key by key. Names compose from a small vocabulary plus per-language format templates, so word order and grammatical case can differ (e.g. Polish genitive "3. Niedziela Okresu Zwykłego"); any string a language omits falls back to English. - Move day-name generation out of calendar (calendar.HumanizeSlug removed, calendar stays a pure engine) into naming.DayName; the English golden cases carry over verbatim. - naming.CelebrationName unifies the three duplicated resolvers (cli/readings/calfeed): name.<lang> -> English -> Latin -> humanized slug. Saint names stay in the calendar data (name.<lang>), overridable via calendar layers. - config: ui_language now accepts any code (lower-cased, not clamped to en/pl) so names/<code>.ini applies; UI chrome still resolves en/pl and falls back to English. Add NamesDir(); wire naming.SetUserDir (and the previously unwired bible.SetUserCorporaDir) in the TUI and web mains too, so external corpora and name files work across all three binaries.
Diffstat (limited to 'internal/calendar/names_test.go')
-rw-r--r--internal/calendar/names_test.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/internal/calendar/names_test.go b/internal/calendar/names_test.go
deleted file mode 100644
index 217f481..0000000
--- a/internal/calendar/names_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package calendar
-
-import "testing"
-
-func TestHumanizeSlug(t *testing.T) {
- cases := map[string]string{
- "ordinary-sunday-11": "11th Sunday in Ordinary Time",
- "ordinary-11-tue": "Tuesday of the 11th Week in Ordinary Time",
- "advent-2-mon": "Monday of the 2nd Week of Advent",
- "advent-dec-17": "December 17",
- "lent-after-ashes-wed": "Ash Wednesday",
- "lent-after-ashes-thu": "Thursday after Ash Wednesday",
- "triduum-fri": "Good Friday",
- "easter-octave-mon": "Monday in the Octave of Easter",
- "christmas-jan-2": "January 2",
- "christmas-after-epiphany-mon": "Monday after the Epiphany",
- "trinity-sunday": "The Most Holy Trinity",
- "ef-time-after-pentecost-4-tue": "Tuesday of the 4th Week after Pentecost",
- "ef-passiontide-0-thursday": "Thursday of Passion Week",
- "ef-september-ember-wed": "Ember Wednesday of September",
- }
- for slug, want := range cases {
- if got := HumanizeSlug(slug); got != want {
- t.Errorf("HumanizeSlug(%q) = %q, want %q", slug, got, want)
- }
- }
-}