fix(timeline): pluralize the zeitstrahl meta-line counts

A count of one rendered "1 Briefe" / "1 Ereignisse". Add _singular
companion keys (de/en/es) and select them when the count is exactly one,
following the project's _singular/_plural convention.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-14 12:15:11 +02:00
parent 9665c9c0fc
commit 398babe584
6 changed files with 38 additions and 5 deletions

View File

@@ -18,12 +18,21 @@ const metaLine = $derived.by(() => {
if (meta.firstYear !== null && meta.lastYear !== null) {
segments.push(`${meta.firstYear}${meta.lastYear}`);
}
// A zero-count segment ("0 Briefe") reads as a data error — drop it.
// A zero-count segment ("0 Briefe") reads as a data error — drop it; a count
// of one takes the singular key ("1 Brief"), per the project plural convention.
if (meta.letterCount > 0) {
segments.push(m.timeline_letters_count({ count: meta.letterCount }));
segments.push(
meta.letterCount === 1
? m.timeline_letters_count_singular()
: m.timeline_letters_count({ count: meta.letterCount })
);
}
if (meta.eventCount > 0) {
segments.push(m.timeline_events_count({ count: meta.eventCount }));
segments.push(
meta.eventCount === 1
? m.timeline_events_count_singular()
: m.timeline_events_count({ count: meta.eventCount })
);
}
segments.push(m.timeline_grouping_date());
return segments.join(' · ');