summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/i18n/i18n.go7
-rw-r--r--internal/i18n/vocab_test.go22
-rw-r--r--internal/liturgy/section.go6
-rw-r--r--internal/readings/offline.go7
4 files changed, 36 insertions, 6 deletions
diff --git a/internal/i18n/i18n.go b/internal/i18n/i18n.go
index 356cc66..6785705 100644
--- a/internal/i18n/i18n.go
+++ b/internal/i18n/i18n.go
@@ -26,8 +26,11 @@ type UI struct {
// 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.
+ // class-1..class-4/commemoration. The English values are hand-synced to
+ // agree with internal/cli/liturgy.go's own rankLabel() switch, but the
+ // CLI does not read this map -- it renders rank independently, and the
+ // two are kept in sync by hand. The actual consumers of this map are the
+ // dlectio app's day banner and calendar rows.
Rank map[string]string
// TUI keybar and status messages. NoReadingsFor and ErrorPrefix each
diff --git a/internal/i18n/vocab_test.go b/internal/i18n/vocab_test.go
index d25533a..bcd3464 100644
--- a/internal/i18n/vocab_test.go
+++ b/internal/i18n/vocab_test.go
@@ -43,3 +43,25 @@ func TestEnglishRankWordingUnchanged(t *testing.T) {
}
}
}
+
+// The Polish rank words must be exactly this spelling, diacritics included:
+// TestVocabularyCoversEveryConstant only checks non-emptiness, so a typo
+// (e.g. "uroczystosc" for "uroczystość", or a wrong diacritic) would pass
+// silently without this pin. Polish correctness is the whole point of this
+// project.
+func TestPolishRankWordingUnchanged(t *testing.T) {
+ want := 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",
+ }
+ ui := Get("pl")
+ for k, v := range want {
+ if got := ui.Rank[k]; got != v {
+ t.Errorf("rank[%q] = %q, want %q", k, got, v)
+ }
+ }
+}
diff --git a/internal/liturgy/section.go b/internal/liturgy/section.go
index 485a45f..baf2b9d 100644
--- a/internal/liturgy/section.go
+++ b/internal/liturgy/section.go
@@ -36,6 +36,10 @@ type DayInfo struct {
// Rank is the normalized liturgical rank of the observed celebration:
// the Ordinary Form's "ferial", "optional", "memorial", "feast",
// "solemnity", or the 1962 form's "class-1".."class-4",
- // "commemoration". Empty when the day carries no rank.
+ // "commemoration". The engine always supplies a rank: an unset or
+ // unrecognised rank on a sanctoral celebration defaults to "ferial"
+ // (calendar.buildCelebration), and every temporal-day constructor sets
+ // one explicitly. Consumers must not treat an empty Rank as meaning "no
+ // celebration".
Rank string
}
diff --git a/internal/readings/offline.go b/internal/readings/offline.go
index 2f96c14..59a03fa 100644
--- a/internal/readings/offline.go
+++ b/internal/readings/offline.go
@@ -109,9 +109,10 @@ func sectionsFor(rs []calendar.Reading, form, lang, siglaLang string, tbl *bible
return out
}
-// dayInfo builds the header (celebration name, liturgical colour) for the
-// computed day. Season is left empty: the celebration name already carries the
-// temporal identity for temporal days, and the header is a nice-to-have.
+// dayInfo builds the header (celebration name, liturgical colour, rank) for
+// the computed day. Season is left empty: the celebration name already
+// carries the temporal identity for temporal days, and the header is a
+// nice-to-have.
func dayInfo(cfg config.Config, day calendar.LiturgicalDay) liturgy.DayInfo {
return liturgy.DayInfo{
Name: celebrationName(cfg, day.Observed),