diff options
Diffstat (limited to 'internal/cli/liturgy.go')
| -rw-r--r-- | internal/cli/liturgy.go | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/internal/cli/liturgy.go b/internal/cli/liturgy.go index bb250a5..ced23ae 100644 --- a/internal/cli/liturgy.go +++ b/internal/cli/liturgy.go @@ -61,18 +61,35 @@ func dayReadings(sel calendar.Selection, layers []calendar.Layer, date time.Time return nil } -// vernacularVersion is the COMPLETE offline corpus used to render reading text. -// The Wujek (wuj) corpus is intentionally NOT auto-selected here: it lacks the -// deuterocanonical Daniel/Esther additions and ~400 verses its builder dropped, -// so Polish renders from the complete Latin Vulgate until a properly-formatted -// Polish Bible is supplied as a user corpus (the national-bibles feature). wuj -// stays available for explicit `--ref -b wuj` and version comparison. English -// uses Douay-Rheims (complete after the deuterocanon backfill); bt is scraped. +// vernacularVersion is the corpus that renders reading text: the config's +// resolved reading corpus (Config.ReadingCorpus -- an explicit +// reading_version, else a reading_lang/ui_language match against +// autoselect-eligible corpora), else the complete Latin Vulgate. The +// built-in Wujek (wuj) sets autoselect=false in its sidecar (it lacks the +// deuterocanonical Daniel/Esther additions and ~400 verses its builder +// dropped), so Polish still falls back to Latin until a properly-formatted +// Polish Bible is supplied as a user corpus (the national-bibles feature); +// wuj stays available for explicit `--ref -b wuj` and version comparison. func vernacularVersion(cfg config.Config) string { - if cfg.TraditionalLang == "pl" || cfg.UILanguage == "pl" { - return "vul" // Latin: no complete Polish corpus yet (wuj is defective) + if code := cfg.ReadingCorpus(); code != "" { + return code } - return "drb" + return latinFallback // "vul" +} + +// versionDisplayName resolves a corpus code's display label for lang: the +// localized i18n chrome label (internal/i18n) when lang defines one for +// code, else the corpus's own sidecar Name (bible.Meta -- covers user and +// other registered corpora the built-in i18n tables don't know about), else +// the bare code. +func versionDisplayName(lang, code string) string { + if l, ok := i18n.Get(lang).Version[code]; ok { + return l + } + if m, ok := bible.Meta(code); ok && m.Name != "" { + return m.Name + } + return code } // latinFallback is the corpus used to render a passage the vernacular corpus @@ -138,8 +155,8 @@ func printLiturgicalDay(out io.Writer, cfg config.Config, tbl *bible.BookTable, continue } if used != vern { // the vernacular lacked it; fell back to Latin - names := i18n.Get("en").Version - fmt.Fprintf(out, " [%s has no text here -- showing %s]\n", names[vern], names[used]) + fmt.Fprintf(out, " [%s has no text here -- showing %s]\n", + versionDisplayName("en", vern), versionDisplayName("en", used)) } for _, line := range strings.Split(render.Wrap(txt, 72), "\n") { fmt.Fprintf(out, " %s\n", line) |
