summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-24 17:07:48 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-24 17:07:48 +0200
commit8a7839cad92a264d68635e4c853347d763b8e457 (patch)
tree223a9d069b8f6762a743645690793cf73f732f24
parent378926240f34759116b19e078d2b2504965f5329 (diff)
downloadlectio-8a7839cad92a264d68635e4c853347d763b8e457.tar.gz
lectio-8a7839cad92a264d68635e4c853347d763b8e457.zip
export: localize calendar title (month name via i18n Months + lectionary label); --ui-lang flag overrides interface/export language (cli + web ?lang=); v0.24.0
-rw-r--r--internal/cli/cli.go7
-rw-r--r--internal/config/config.go2
-rw-r--r--internal/export/calendar.go15
-rw-r--r--internal/i18n/i18n.go6
-rw-r--r--internal/web/server.go6
5 files changed, 30 insertions, 6 deletions
diff --git a/internal/cli/cli.go b/internal/cli/cli.go
index 24d1fec..d69bce0 100644
--- a/internal/cli/cli.go
+++ b/internal/cli/cli.go
@@ -40,6 +40,7 @@ Flags:
-o, --offline cache/sigla only, no network
-l, --lectionary WHICH new|trad (trad -> traditional)
-g, --lang LANG traditional lectionary language: pl|en
+ --ui-lang LANG override interface/export language: pl|en
-u, --update harvest sigla maximally to the horizon (idempotent)
-C, --clean prune cached readings older than a year
-P, --pager page reading output (like git); default from config
@@ -113,7 +114,7 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int {
var all, raw, refresh, offline, update, clean, pagerFlag, noPager, citation, week bool
var randV, randCh bool
var expMD, expPDF bool
- var output, calendar string
+ var output, calendar, uiLang string
var bibleVer, compareList, lectionary, lang string
var width int
var list bool
@@ -141,6 +142,7 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int {
fs.StringVar(&lectionary, "lectionary", "", "new|trad")
fs.StringVar(&lang, "g", "", "pl|en")
fs.StringVar(&lang, "lang", "", "pl|en")
+ fs.StringVar(&uiLang, "ui-lang", "", "override interface/export language: pl|en")
fs.BoolVar(&update, "u", false, "harvest sigla maximally to the horizon")
fs.BoolVar(&update, "update", false, "harvest sigla maximally to the horizon")
fs.BoolVar(&clean, "C", false, "prune cached readings older than a year")
@@ -201,6 +203,9 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int {
if lang != "" {
cfg.TraditionalLang = lang
}
+ if uiLang != "" {
+ cfg.UILanguage = config.NormalizeUILanguage(uiLang)
+ }
if citation || week || randV || randCh {
tbl, _ := bible.LoadBookTable(userBooksTOML())
diff --git a/internal/config/config.go b/internal/config/config.go
index ee63754..f4c9fc8 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -25,7 +25,7 @@ var seedTOML []byte
// Version is lectio's release version, shared by every binary's
// -v/--version output (lectio, lectio-ui, lectio-web).
-const Version = "0.23.0"
+const Version = "0.24.0"
// validVersions are the five scripture versions lectio understands.
var validVersions = map[string]bool{
diff --git a/internal/export/calendar.go b/internal/export/calendar.go
index 8828892..10f9ffb 100644
--- a/internal/export/calendar.go
+++ b/internal/export/calendar.go
@@ -7,6 +7,8 @@ import (
"time"
"github.com/go-pdf/fpdf"
+
+ "github.com/lukaszkasprzak/lectio/internal/i18n"
)
// CalendarDay is one day's entry in a month calendar: the day-of-month, the
@@ -65,12 +67,17 @@ func CalendarPDF(year, month int, days []CalendarDay, lectionary, lang string) (
pdf.AddPage()
pw, ph := pdf.GetPageSize()
- lect := lectionary
- if lect == "new" {
- lect = "modern"
+ ui := i18n.Get(lang)
+ lect := ui.OptModern
+ if lectionary == "traditional" {
+ lect = ui.OptTraditional
+ }
+ monthName := time.Month(month).String()
+ if month >= 1 && month <= 12 && ui.Months[month-1] != "" {
+ monthName = ui.Months[month-1]
}
pdf.SetFont(fontFamily, "B", 16)
- pdf.CellFormat(0, 9, fmt.Sprintf("%s %d — %s", time.Month(month).String(), year, lect), "", 1, "L", false, 0, "")
+ pdf.CellFormat(0, 9, fmt.Sprintf("%s %d — %s", monthName, year, lect), "", 1, "L", false, 0, "")
const gridY0 = 22.0
const weekdayH = 6.0
diff --git a/internal/i18n/i18n.go b/internal/i18n/i18n.go
index 4c343f9..2e730ee 100644
--- a/internal/i18n/i18n.go
+++ b/internal/i18n/i18n.go
@@ -40,6 +40,10 @@ type UI struct {
// "Ewangelia na 2026-07-22").
BannerGospel, BannerReadings, BannerConnective string
+ // Months are the localized month names (index 0 = January), for the
+ // exported calendar's title.
+ Months [12]string
+
// Web control labels.
Lectionary, OptModern, OptTraditional string
Parts, OptGospel, OptAll string
@@ -118,6 +122,7 @@ var enUI = UI{
BannerGospel: "Gospel",
BannerReadings: "Readings",
BannerConnective: "for",
+ Months: [12]string{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"},
Lectionary: "lectionary",
OptModern: "modern",
OptTraditional: "traditional",
@@ -182,6 +187,7 @@ var plUI = UI{
BannerGospel: "Ewangelia",
BannerReadings: "Czytania",
BannerConnective: "na",
+ Months: [12]string{"Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"},
Lectionary: "lekcjonarz",
OptModern: "nowy",
OptTraditional: "tradycyjny",
diff --git a/internal/web/server.go b/internal/web/server.go
index 5ebed38..a586534 100644
--- a/internal/web/server.go
+++ b/internal/web/server.go
@@ -345,6 +345,9 @@ func readingsHandler(cfg config.Config) http.HandlerFunc {
// date/lectionary/all/version resolution as the reading pane.
func exportHandler(cfg config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
+ if l := r.URL.Query().Get("lang"); l != "" {
+ cfg.UILanguage = config.NormalizeUILanguage(l)
+ }
date, lectionary, all, versions, _ := resolveQuery(cfg, r)
secs, dayInfo, loadVersions, err := loadSections(cfg, lectionary, date, all, versions)
if err != nil {
@@ -387,6 +390,9 @@ func exportHandler(cfg config.Config) http.HandlerFunc {
// bad month defaults to the current month.
func calendarHandler(cfg config.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
+ if l := r.URL.Query().Get("lang"); l != "" {
+ cfg.UILanguage = config.NormalizeUILanguage(l)
+ }
t, err := time.Parse("2006-01", r.URL.Query().Get("month"))
if err != nil {
t = time.Now()