From 3dcb5c7f2b76786469c1d6d4a1e3040b644555ae Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 1 May 2026 13:10:29 +0200 Subject: [PATCH] i18n(faith): migrate streak components, BibleModal, katechese notices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds streak/angelus and Bible-modal keys to the faith dictionary, plus the three-fragment "this catechesis is only available in German" notice used by both katechese pages. Pluralization for day/days handled by two explicit keys (day_singular/day_plural) chosen at the call site — Latin's "Dies" is invariant so both keys hold the same string. StreakCounter and AngelusStreakCounter collapse their per-component labels objects into direct t.foo lookups; the rosary page's BibleModal call site now passes the typed `lang` derived value (was data.lang as plain string, didn't satisfy the tightened FaithLang prop type). BibleModal isn't actually used in Latin context, but the dict requires every key in every locale, so reasonable Latin equivalents got filled in for completeness. --- package.json | 2 +- .../faith/AngelusStreakCounter.svelte | 30 +++++++------------ src/lib/components/faith/BibleModal.svelte | 13 ++++---- src/lib/components/faith/StreakCounter.svelte | 22 +++++--------- src/lib/i18n/faith/de.ts | 24 ++++++++++++++- src/lib/i18n/faith/en.ts | 24 ++++++++++++++- src/lib/i18n/faith/la.ts | 24 ++++++++++++++- .../[rosary=rosaryLang]/+page.svelte | 2 +- .../katechese/+page.svelte | 9 ++++-- .../katechese/zehn-gebote/+page.svelte | 8 +++-- 10 files changed, 108 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index 250f6c77..6e320629 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homepage", - "version": "1.55.0", + "version": "1.55.1", "private": true, "type": "module", "scripts": { diff --git a/src/lib/components/faith/AngelusStreakCounter.svelte b/src/lib/components/faith/AngelusStreakCounter.svelte index de0fb673..d18f55ce 100644 --- a/src/lib/components/faith/AngelusStreakCounter.svelte +++ b/src/lib/components/faith/AngelusStreakCounter.svelte @@ -5,6 +5,7 @@ import StreakAura from '$lib/components/faith/StreakAura.svelte'; import Coffee from '@lucide/svelte/icons/coffee'; import Sun from '@lucide/svelte/icons/sun'; import Moon from '@lucide/svelte/icons/moon'; +import { m, type FaithLang } from '$lib/js/faithI18n'; import { tick, onMount } from 'svelte'; let burst = $state(false); @@ -13,14 +14,13 @@ let selectedSlot = $state('morning'); interface Props { streakData?: { streak: number; lastComplete: string | null; todayPrayed: number; todayDate: string | null } | null; - lang?: 'de' | 'en' | 'la'; + lang?: FaithLang; isLoggedIn?: boolean; } let { streakData = null, lang = 'de', isLoggedIn = false }: Props = $props(); -const isEnglish = $derived(lang === 'en'); -const isLatin = $derived(lang === 'la'); +const t = $derived(m[lang]); // Display values: store when available, SSR fallback const displayStreak = $derived(store?.streak ?? streakData?.streak ?? 0); @@ -52,20 +52,12 @@ const slots: { key: TimeSlot; icon: typeof Coffee; color: string }[] = [ { key: 'evening', icon: Moon, color: 'var(--nord15)' } ]; -const labels = $derived({ - days: isLatin ? 'Dies' : isEnglish ? (displayStreak === 1 && !showFraction ? 'Day' : 'Days') : (displayStreak === 1 && !showFraction ? 'Tag' : 'Tage'), - pray: isLatin ? 'Oravi' : isEnglish ? 'Prayed' : 'Gebetet', - done: isLatin ? 'Hodie completa' : isEnglish ? 'Done today' : 'Heute fertig', - morning: isLatin ? 'Mane' : isEnglish ? 'Morning' : 'Morgens', - noon: isLatin ? 'Meridie' : isEnglish ? 'Noon' : 'Mittags', - evening: isLatin ? 'Vespere' : isEnglish ? 'Evening' : 'Abends', - ariaLabel: isLatin ? 'Orationem notatam fac' : isEnglish ? 'Mark prayer as prayed' : 'Gebet als gebetet markieren' -}); +const dayLabel = $derived(displayStreak === 1 && !showFraction ? t.day_singular : t.day_plural); const slotLabels: Record = $derived({ - morning: labels.morning, - noon: labels.noon, - evening: labels.evening + morning: t.morning, + noon: t.noon, + evening: t.evening }); function isSlotPrayed(slot: TimeSlot): boolean { @@ -105,7 +97,7 @@ async function pray() { {displayStreak}{#if showFraction}{partialCount}/3{/if} - {labels.days} + {dayLabel}
@@ -132,12 +124,12 @@ async function pray() { class="pray-button" type="submit" disabled={todayComplete || selectedSlotPrayed} - aria-label={labels.ariaLabel} + aria-label={t.mark_prayer} > {#if todayComplete} - {labels.done} + {t.done_today} {:else} - {labels.pray} + {t.prayed} {/if} diff --git a/src/lib/components/faith/BibleModal.svelte b/src/lib/components/faith/BibleModal.svelte index 2b6ae49f..cf621f9f 100644 --- a/src/lib/components/faith/BibleModal.svelte +++ b/src/lib/components/faith/BibleModal.svelte @@ -1,5 +1,6 @@ @@ -49,7 +52,7 @@

Katechese

{#if !isGerman} -

{isLatin ? 'Haec catechesis tantum in ' : 'This catechesis is only available in '}{isLatin ? 'lingua Germanica' : 'German'}{isLatin ? ' praesto est.' : '.'}

+

{t.only_german_pre}{t.only_german_link}{t.only_german_post}

{/if}

Aufgearbeitete Lehrinhalte aus dem Glaubenskurs von P. Martin Ramm FSSP. diff --git a/src/routes/[faithLang=faithLang]/katechese/zehn-gebote/+page.svelte b/src/routes/[faithLang=faithLang]/katechese/zehn-gebote/+page.svelte index 26d283ce..d01cefa1 100644 --- a/src/routes/[faithLang=faithLang]/katechese/zehn-gebote/+page.svelte +++ b/src/routes/[faithLang=faithLang]/katechese/zehn-gebote/+page.svelte @@ -5,10 +5,12 @@ import ArrowLeft from '@lucide/svelte/icons/arrow-left'; import { page } from '$app/state'; import ApologetikToc from '$lib/components/faith/ApologetikToc.svelte'; + import { m, langFromFaithSlug } from '$lib/js/faithI18n'; /** @type {number | string | null} */ let expanded = $state(null); - const isGerman = $derived(page.url.pathname.startsWith('/glaube')); - const isLatin = $derived(page.url.pathname.startsWith('/fides')); + const lang = $derived(langFromFaithSlug(page.url.pathname.split('/')[1])); + const t = $derived(m[lang]); + const isGerman = $derived(lang === 'de'); /** @param {number | string} id */ function toggle(id) { @@ -93,7 +95,7 @@ {#if !isGerman} -

{isLatin ? 'Haec catechesis tantum in ' : 'This catechesis is only available in '}{isLatin ? 'lingua Germanica' : 'German'}{isLatin ? ' praesto est.' : '.'}

+

{t.only_german_pre}{t.only_german_link}{t.only_german_post}

{/if}