Add nameLa mechanism for bilingual header, proof set of 11 feasts + St. Lawrence
Deploy / deploy (push) Successful in 1m32s

Threads an optional nameLa field through SanctoralIdentity/SaintRecord/
TemporalFeastRecord/ActiveOctave so day-label.ts can render real Latin
proper names instead of always falling back to English. Authors the
proof set: all 11 named temporal feasts plus St. Lawrence (chosen to
exercise the octave-headline and octave-commemoration code paths too).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwsZQMjALCvy7u9tFDWmuQ
This commit is contained in:
2026-08-31 06:30:48 -04:00
parent 76cc363a75
commit a6261f044a
27 changed files with 190 additions and 50 deletions
+2 -2
View File
@@ -19,11 +19,11 @@ export interface CollisionResult {
}
function asWinner(candidate: SanctoralIdentity): DayWinner {
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, rank: candidate.rank };
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, nameLa: candidate.nameLa, rank: candidate.rank };
}
function asCommemoration(candidate: SanctoralIdentity): Commemoration {
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, rank: candidate.rank };
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, nameLa: candidate.nameLa, rank: candidate.rank };
}
/**
+2 -2
View File
@@ -83,11 +83,11 @@ export interface OccurrenceResult {
}
function sanctoralCommemoration(candidate: SanctoralIdentity): Commemoration {
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, rank: candidate.rank };
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, nameLa: candidate.nameLa, rank: candidate.rank };
}
function sanctoralWinner(candidate: SanctoralIdentity): DayWinner {
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, rank: candidate.rank };
return { kind: 'sanctoral', id: candidate.id, name: candidate.name, nameLa: candidate.nameLa, rank: candidate.rank };
}
/**
+23 -20
View File
@@ -12,12 +12,14 @@
//
// Bilingual: every label is built as a `Bi` (`{en, la}`) pair throughout.
// Proper names (a saint's name, an octave's name, a named temporal feast's
// name) have no authored Latin form anywhere in `data/` today — those use
// the English string as their own `la` value too (same "surface real text
// rather than block on missing" convention used elsewhere in this app),
// rather than leaving Latin mode showing blanks. Only the closed,
// name) carry an optional `nameLa` field alongside the required English
// `name` — see calendar/types.ts's `SanctoralIdentity.nameLa` doc comment.
// Most saints still have no authored Latin name; `biName` falls back to
// the English string as the `la` value in that case (same "surface real
// text rather than block on missing" convention used elsewhere in this
// app), rather than leaving Latin mode showing blanks. The closed,
// mechanism-level vocabulary here (weekdays, ranks, season/ordinal
// phrasing) has real Latin authored.
// phrasing) has always had real Latin authored, independent of this.
import type { FeastClass, LiturgicalDay, TemporalCategory, Weekday } from './types';
import { easterSunday } from './easter';
import { adventStart, firstSundayStrictlyAfter, sundayOnOrBefore } from './temporal';
@@ -36,10 +38,11 @@ function bi(en: string, la: string): Bi {
return { en, la };
}
/** A proper name with no authored Latin form yet — the English string
* stands in for `la` too. See file-header note. */
function biFallback(name: string): Bi {
return { en: name, la: name };
/** A proper name (saint, octave, named temporal feast) with an optional
* authored Latin form — falls back to the English string when `nameLa`
* hasn't been authored yet, same convention as `biFallback` above. */
function biName(name: string, nameLa: string | undefined): Bi {
return { en: name, la: nameLa ?? name };
}
function joinBi(items: Bi[], sep = ' — '): Bi {
@@ -348,13 +351,13 @@ function temporalLabel(day: LiturgicalDay): Bi {
* own winner is the feast itself, handled above before this is ever
* called) — kept simple rather than special-cased for that rare edge case
* (see applyOctaves's own `isOwnStartDay` comment in calendar/index.ts for
* when it can happen). The octave's own `name` has no authored Latin form
* (see file header), so both languages currently show the same name text
* — only the surrounding phrasing differs. */
* when it can happen). Falls back to the English name for `la` too when
* the octave's own record has no authored `nameLa` yet (see file header). */
function octaveCoreName(octave: ActiveOctave): Bi {
const name = biName(octave.name, octave.nameLa);
return octave.isClosingDay
? bi(`Octave of ${octave.name}`, `In Octava ${octave.name}`)
: bi(`${ordinal(octave.dayNumber)} Day within the Octave of ${octave.name}`, `${ordinalLa(octave.dayNumber)} die infra Octavam ${octave.name}`);
? bi(`Octave of ${name.en}`, `In Octava ${name.la}`)
: bi(`${ordinal(octave.dayNumber)} Day within the Octave of ${name.en}`, `${ordinalLa(octave.dayNumber)} die infra Octavam ${name.la}`);
}
function octaveLabel(octave: ActiveOctave): Bi {
@@ -405,8 +408,8 @@ const CROSS_DAY_VESPERS_LABELS: Record<'today' | 'tomorrow', Bi> = {
* - `sanctoral`: every commemorated saint, plain name, no rank (multiple
* real ones can coexist — e.g. two colliding saints on the same date —
* this app's own "generous commemorations" design keeps every one of
* them, not just the first). No authored Latin saint names exist yet
* (see file header), so `la` falls back to the same English name.
* them, not just the first). `la` uses the saint's own `nameLa` when
* authored, else falls back to the same English name (see file header).
* - `temporal`: the day's own real Sunday/feria identity, if
* `decideOccurrence` demoted it to a commemoration (`ordinary-sunday`/
* `privileged-feria`/`privileged-feria-minor`) — matched by id against
@@ -438,7 +441,7 @@ function collectCommemorations(
const octaves: Bi[] = [];
for (const c of day.commemorations) {
if (c.kind === 'sanctoral') {
const name = biFallback(c.name);
const name = biName(c.name, c.nameLa);
sanctoral.push(
c.vespersNote
? bi(`${name.en} (${CROSS_DAY_VESPERS_LABELS[c.vespersNote].en})`, `${name.la} (${CROSS_DAY_VESPERS_LABELS[c.vespersNote].la})`)
@@ -450,7 +453,7 @@ function collectCommemorations(
}
} else if (opts.showOctaves && c.id !== opts.excludeOctaveId) {
const octave = activeOctaves.find((a) => a.id === c.id);
octaves.push(octave ? octaveCommemorationLabel(octave) : biFallback(c.name));
octaves.push(octave ? octaveCommemorationLabel(octave) : biName(c.name, c.nameLa));
}
}
return { sanctoral, temporal, octaves };
@@ -542,7 +545,7 @@ export function getDayLabel(day: LiturgicalDay): Partial<Record<string, string>>
showOctaves: day.temporalCategory === 'ordinary-feria',
});
const rank = formatRank(day.winner.rank);
const winnerName = biFallback(day.winner.name);
const winnerName = biName(day.winner.name, day.winner.nameLa);
const winner = bi(`${winnerName.en} (${rank.en})`, `${winnerName.la} (${rank.la})`);
return joinBi([winner, ...temporal, ...sanctoral, ...octaves]);
}
@@ -554,7 +557,7 @@ export function getDayLabel(day: LiturgicalDay): Partial<Record<string, string>>
// temporal-feasts.ts) and fall through further down.
const namedFeast = getTemporalFeastRecord(day.winner.id);
if (namedFeast) {
const name = biFallback(namedFeast.name);
const name = biName(namedFeast.name, namedFeast.nameLa);
const primary = namedFeast.rank
? bi(`${name.en} (${formatRank(namedFeast.rank).en})`, `${name.la} (${formatRank(namedFeast.rank).la})`)
: name;
+5 -1
View File
@@ -15,6 +15,9 @@ import sanctoralCalendarData from '../data/calendar/sanctoral-calendar.yml';
export interface SaintRecord {
id: string;
name: string;
/** Latin form of `name`, when authored — see calendar/types.ts's
* `SanctoralIdentity.nameLa` doc comment for the display fallback. */
nameLa?: string;
rank: FeastClass;
common: string;
propers: string | null;
@@ -138,6 +141,7 @@ for (const mod of Object.values(saintModules)) {
export interface SanctoralCandidate {
id: string;
name: string;
nameLa?: string;
rank: FeastClass;
}
@@ -157,6 +161,6 @@ export function getSanctoralCandidatesFor(isoDate: string): SanctoralCandidate[]
if (!saint) {
throw new Error(`sanctoral-calendar.yml references unknown saint id '${id}'`);
}
return { id: saint.id, name: saint.name, rank: saint.rank };
return { id: saint.id, name: saint.name, nameLa: saint.nameLa, rank: saint.rank };
});
}
+4 -4
View File
@@ -237,7 +237,7 @@ function applyChristmasOctaveSunday(
if (idx !== -1) {
commemorations.splice(idx, 1);
}
return { kind: 'sanctoral', id: displaced.id, name: displaced.name, rank: displaced.rank };
return { kind: 'sanctoral', id: displaced.id, name: displaced.name, nameLa: displaced.nameLa, rank: displaced.rank };
}
}
@@ -290,7 +290,7 @@ function applyMarianSaturday(
if (winner.rank !== 'simplex') {
return winner;
}
commemorations.push({ kind: 'sanctoral', id: winner.id, name: winner.name, rank: winner.rank });
commemorations.push({ kind: 'sanctoral', id: winner.id, name: winner.name, nameLa: winner.nameLa, rank: winner.rank });
return MARIAN_SATURDAY;
}
@@ -343,7 +343,7 @@ function applyOctaves(isoDate: string, winner: DayWinner, commemorations: Commem
if (cmp < 0 || tiedAgainstClosingDay) {
const isOneOfTheseOctaves = octaves.some((o) => o.id === winner.id);
if (!isOneOfTheseOctaves) {
commemorations.push({ kind: 'sanctoral', id: winner.id, name: winner.name, rank: winner.rank });
commemorations.push({ kind: 'sanctoral', id: winner.id, name: winner.name, nameLa: winner.nameLa, rank: winner.rank });
resolvedWinner = { kind: 'temporal', id: resolveTemporalId(isoDate) };
}
}
@@ -356,7 +356,7 @@ function applyOctaves(isoDate: string, winner: DayWinner, commemorations: Commem
// again alongside itself would be redundant.
const isOwnStartDay = octave.dayNumber === 1 && resolvedWinner.kind === 'temporal';
if (!isSelf && !isOwnStartDay) {
commemorations.push({ kind: 'octave', id: octave.id, name: octave.name });
commemorations.push({ kind: 'octave', id: octave.id, name: octave.name, nameLa: octave.nameLa });
}
}
+2 -2
View File
@@ -83,7 +83,7 @@ export function applyMovableFeasts(isoDate: string, winner: DayWinner, commemora
if (resolvedWinner.kind === 'temporal') {
commemorations.push({ kind: 'temporal', id: resolvedWinner.id });
} else {
commemorations.push({ kind: 'sanctoral', id: resolvedWinner.id, name: resolvedWinner.name, rank: resolvedWinner.rank });
commemorations.push({ kind: 'sanctoral', id: resolvedWinner.id, name: resolvedWinner.name, nameLa: resolvedWinner.nameLa, rank: resolvedWinner.rank });
}
resolvedWinner = FEAST_WINNER;
continue;
@@ -95,7 +95,7 @@ export function applyMovableFeasts(isoDate: string, winner: DayWinner, commemora
} else if (compareFeastClass(resolvedWinner.rank, rank) >= 0) {
commemorations.push({ kind: 'temporal', id: feast.id });
} else {
commemorations.push({ kind: 'sanctoral', id: resolvedWinner.id, name: resolvedWinner.name, rank: resolvedWinner.rank });
commemorations.push({ kind: 'sanctoral', id: resolvedWinner.id, name: resolvedWinner.name, nameLa: resolvedWinner.nameLa, rank: resolvedWinner.rank });
resolvedWinner = FEAST_WINNER;
}
}
+7 -3
View File
@@ -17,6 +17,9 @@ import { compareFeastClass, minimumOutrightWinningRank } from './commemorations'
export interface ActiveOctave {
id: string;
name: string;
/** Latin form of `name`, when authored — see calendar/types.ts's
* `SanctoralIdentity.nameLa` doc comment for the display fallback. */
nameLa?: string;
/** This octave's own effective rank *today* — the ordinary `wins`
* threshold on every day except its own closing day, where it's
* `closingDayRank` instead (see calendar/types.ts's OctaveConfig).
@@ -49,6 +52,7 @@ function considerCandidate(
startDate: string,
id: string,
name: string,
nameLa: string | undefined,
octave: OctaveConfig | undefined,
): void {
if (!octave?.enabled || seen.has(id)) {
@@ -63,7 +67,7 @@ function considerCandidate(
const dayNumber = offset + 1;
const isClosingDay = dayNumber === days;
const wins = isClosingDay ? (octave.closingDayRank ?? DEFAULT_CLOSING_DAY_RANK) : (octave.wins ?? DEFAULT_WINS);
active.push({ id, name, wins, dayNumber, isClosingDay });
active.push({ id, name, nameLa, wins, dayNumber, isClosingDay });
}
/** Every octave (sanctoral or temporal) whose window covers `isoDate`,
@@ -80,14 +84,14 @@ export function activeOctavesFor(isoDate: string): ActiveOctave[] {
for (const candidate of getSanctoralCandidatesFor(candidateDate)) {
const record = getSaintRecord(candidate.id);
if (record) {
considerCandidate(active, seen, isoDate, candidateDate, record.id, record.name, record.octave);
considerCandidate(active, seen, isoDate, candidateDate, record.id, record.name, record.nameLa, record.octave);
}
}
for (const feastId of temporalFeastIdsStartingOn(candidateDate)) {
const record = getTemporalFeastRecord(feastId);
if (record) {
considerCandidate(active, seen, isoDate, candidateDate, record.id, record.name, record.octave);
considerCandidate(active, seen, isoDate, candidateDate, record.id, record.name, record.nameLa, record.octave);
}
}
}
+3
View File
@@ -30,6 +30,9 @@ export type MovableAnchor =
export interface TemporalFeastRecord {
id: string;
name: string;
/** Latin form of `name`, when authored — see calendar/types.ts's
* `SanctoralIdentity.nameLa` doc comment for the display fallback. */
nameLa?: string;
octave?: OctaveConfig;
rank?: FeastClass;
anchor?: MovableAnchor;
+6 -1
View File
@@ -103,6 +103,11 @@ export type TemporalCategory =
export interface SanctoralIdentity {
id: string;
name: string;
/** Latin form of `name`, when authored (see `data/calendar/saints/*.yml`'s
* own `nameLa` field). Absent for the majority of saints still — display
* code falls back to `name` itself when this is missing, same "surface
* real text rather than block on missing" convention used elsewhere. */
nameLa?: string;
rank: FeastClass;
}
@@ -180,7 +185,7 @@ export type Commemoration =
// carries no such qualifier.
vespersNote?: 'today' | 'tomorrow';
} & SanctoralIdentity)
| { kind: 'octave'; id: string; name: string };
| { kind: 'octave'; id: string; name: string; nameLa?: string };
export interface LiturgicalDay {
/** ISO date, e.g. "2026-08-09" */
+2 -2
View File
@@ -85,7 +85,7 @@ function commemorationOfDisplacedPredecessor(loser: DayWinner): Commemoration |
if (loser.kind !== 'sanctoral' || loser.rank === 'simplex') {
return undefined;
}
return { kind: 'sanctoral', id: loser.id, name: loser.name, rank: loser.rank, vespersNote: 'today' };
return { kind: 'sanctoral', id: loser.id, name: loser.name, nameLa: loser.nameLa, rank: loser.rank, vespersNote: 'today' };
}
/**
@@ -120,7 +120,7 @@ function commemorationOfDisplacedSuccessor(winner: DayWinner, loser: DayWinner):
if (forbids) {
return undefined;
}
return { kind: 'sanctoral', id: loser.id, name: loser.name, rank: loser.rank, vespersNote: 'tomorrow' };
return { kind: 'sanctoral', id: loser.id, name: loser.name, nameLa: loser.nameLa, rank: loser.rank, vespersNote: 'tomorrow' };
}
function tagVespersFrom(tomorrow: LiturgicalDay): LiturgicalDay {
+4
View File
@@ -6,6 +6,10 @@
# antiphon.
id: st-lawrence
name: "St. Lawrence, Martyr"
# Standard Latin form, matching this app's own "St. X, Rank" naming
# convention (the source's own martyrology/kalendar entries for him use
# the genitive "S. Laurentii Martyris", dependent on an implied "Festum").
nameLa: "Sanctus Laurentius, Martyr"
rank: duplex-2-classis
common: common-of-a-martyr
propers: "st-lawrence"
@@ -15,6 +15,11 @@
# — the `ordinary-feria` category was never actually load-bearing here.
id: ascension
name: "The Ascension of Our Lord"
# Nominative form of the reference engine's own title ("In Ascensione
# Domini", Pasc5-4.txt's [Officium]/[Rank] header), matching this app's
# own nominative-noun-phrase naming convention rather than the source's
# prepositional-phrase style.
nameLa: "Ascensio Domini"
rank: duplex-1-classis
anchor:
kind: easter
@@ -8,6 +8,11 @@
# movable feast. See calendar/movable-feasts.ts for the occurrence rule.
id: christ-the-king
name: "Christ the King"
# The feast's own traditional short Latin title (Pius XI's "Quas Primas"),
# matching this app's nominative-noun-phrase naming convention — the
# reference engine's own [Rank] title is genitive ("Domini Nostri Jesu
# Christi Regis", Sancti/10-DU.txt), dependent on an implied "Festum".
nameLa: "Christus Rex"
rank: duplex-1-classis
anchor:
kind: nth-sunday-of-month
@@ -12,6 +12,10 @@
# specifically.
id: christmas-day
name: "Christmas"
# Nominative form of the reference engine's own title ("In Nativitate
# Domini", Sancti/12-25.txt's [Rank]), matching this app's own
# nominative-noun-phrase naming convention.
nameLa: "Nativitas Domini"
rank: duplex-1-classis
octave:
enabled: true
@@ -20,6 +20,10 @@
# not winner resolution at all.
id: circumcision
name: "The Circumcision of Our Lord"
# Nominative form of the reference engine's own title ("In Circumcisione
# Domini", Sancti/01-01.txt's [Rank]), matching this app's own
# nominative-noun-phrase naming convention.
nameLa: "Circumcisio Domini"
rank: duplex-2-classis
anchor:
kind: fixed-date
@@ -14,6 +14,11 @@
# day's real winner.
id: corpus-christi
name: "The Most Holy Body of Christ"
# Common short Latin title, well attested in the reference engine's own
# text ("Festum Sanctissimi Corporis Christi", Tempora/Pent01-4.txt's
# [Officium]) — already a nominative noun phrase on its own, no
# adaptation needed.
nameLa: "Corpus Christi"
rank: duplex-1-classis
anchor:
kind: easter
@@ -16,6 +16,10 @@
# the day.
id: holy-name-of-jesus
name: "The Most Holy Name of Jesus"
# Nominative form of the reference engine's own title ("Sanctissimi
# Nominis Jesu", Sancti/01-00.txt's [Rank]), matching this app's own
# nominative-noun-phrase naming convention.
nameLa: "Sanctissimum Nomen Jesu"
rank: duplex-2-classis
anchor:
kind: fixed-date
@@ -11,6 +11,10 @@
# own content.
id: immaculate-heart-of-mary
name: "The Immaculate Heart of the Blessed Virgin Mary"
# Nominative form of the reference engine's own title ("Immaculati Cordis
# Beatæ Mariæ Virginis", Sancti/08-22.txt's [Rank]), matching this app's
# own nominative-noun-phrase naming convention.
nameLa: "Immaculatum Cor Beatæ Mariæ Virginis"
rank: duplex-2-classis
anchor:
kind: easter
@@ -5,4 +5,9 @@
# for how a day actually becomes this.
id: marian-saturday
name: "Our Lady's Saturday"
# Adapted to a nominative noun phrase from the reference engine's own
# title ("Sanctæ Mariæ Sabbato", Commune/C10.txt's [Officium] — an
# ablative time-when construction, "on the Saturday of Holy Mary"),
# matching this app's own nominative naming convention.
nameLa: "Sabbatum Sanctæ Mariæ"
rank: simplex
@@ -21,6 +21,11 @@
# (PascN-D = Easter + 7N + D, e.g. Ascension = Pasc5-4 = Easter+39).
id: patronage-of-st-joseph
name: "The Patronage of St. Joseph"
# Nominative form of the reference engine's own title ("In Octava
# Patrocinii S. Joseph", Tempora/Pasc3-3.txt's [Officium], octave-day
# form of the feast's own genitive "Patrocinii S. Joseph"), matching this
# app's own nominative-noun-phrase naming convention.
nameLa: "Patrocinium Sancti Joseph"
rank: duplex-1-classis
anchor:
kind: easter
@@ -10,6 +10,9 @@
# before it gets the chance.
id: pentecost-sunday
name: "Pentecost"
# Reference engine's own [Officium] title, Tempora/Pent00-0.txt — already
# a nominative noun phrase, no adaptation needed.
nameLa: "Dominica Pentecostes"
rank: duplex-1-classis
octave:
enabled: true
@@ -10,6 +10,10 @@
# temporal-feasts.ts's own doc comment) a record to live on.
id: sacred-heart
name: "The Most Sacred Heart of Our Lord Jesus Christ"
# Nominative form of the reference engine's own title ("Sacratissimi
# Cordis Domini Nostri Jesu Christi", Tempora/Pent02-5.txt's [Officium]),
# matching this app's own nominative-noun-phrase naming convention.
nameLa: "Sacratissimum Cor Domini Nostri Jesu Christi"
rank: duplex-1-classis
anchor:
kind: easter