From 66ab5f65f69f9ccbaf223ff30fa4cb8b4b144941 Mon Sep 17 00:00:00 2001 From: Till JS Date: Mon, 27 Apr 2026 14:58:45 +0200 Subject: [PATCH] =?UTF-8?q?i18n(sleep):=20translate=20ListView=20via=20$?= =?UTF-8?q?=5F()=20=E2=80=94=20log=20CTA,=20last-night,=20week=20chart,=20?= =?UTF-8?q?stats,=20heatmap,=20hygiene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Log CTA "Wie hast du geschlafen?" + "Jetzt loggen" - Last-night card: "Letzte Nacht" label, "Bearbeiten" edit button, "{n}× aufgewacht" interpolation - "Diese Woche" week section heading - 5 stat labels (Ø Dauer (7T) / Ø Qualität / Schlafschuld / Konsistenz / Streak) - Quality heatmap: section heading + cell title with {date}/{label} interpolation, label sourced via $_('sleep.qualities.' + n) (added qualities sub-namespace) - Hygiene-correlation card: heading + with/without rows - Action buttons: Schlaf loggen / Hygiene-Check - QUALITY_LABELS import dropped (constant kept in types.ts for non-Svelte callers) Baselines: hardcoded 1034 → 1033 (8 cleared from sleep + 7 added by parallel community-feature commits = net -1); missing-keys baseline +1. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../web/src/lib/i18n/locales/sleep/de.json | 7 +++ .../web/src/lib/i18n/locales/sleep/en.json | 7 +++ .../web/src/lib/i18n/locales/sleep/es.json | 7 +++ .../web/src/lib/i18n/locales/sleep/fr.json | 7 +++ .../web/src/lib/i18n/locales/sleep/it.json | 7 +++ .../web/src/lib/modules/sleep/ListView.svelte | 51 ++++++++++++------- scripts/i18n-hardcoded-baseline.json | 3 +- scripts/i18n-missing-baseline.json | 1 + 8 files changed, 70 insertions(+), 20 deletions(-) diff --git a/apps/mana/apps/web/src/lib/i18n/locales/sleep/de.json b/apps/mana/apps/web/src/lib/i18n/locales/sleep/de.json index aa335ae8f..de8536647 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/sleep/de.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/sleep/de.json @@ -1,4 +1,11 @@ { + "qualities": { + "1": "Sehr schlecht", + "2": "Schlecht", + "3": "Okay", + "4": "Gut", + "5": "Sehr gut" + }, "list_view": { "cta_question": "Wie hast du geschlafen?", "cta_action": "Jetzt loggen", diff --git a/apps/mana/apps/web/src/lib/i18n/locales/sleep/en.json b/apps/mana/apps/web/src/lib/i18n/locales/sleep/en.json index b914d189c..c4a931709 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/sleep/en.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/sleep/en.json @@ -1,4 +1,11 @@ { + "qualities": { + "1": "Very poor", + "2": "Poor", + "3": "Okay", + "4": "Good", + "5": "Very good" + }, "list_view": { "cta_question": "How did you sleep?", "cta_action": "Log now", diff --git a/apps/mana/apps/web/src/lib/i18n/locales/sleep/es.json b/apps/mana/apps/web/src/lib/i18n/locales/sleep/es.json index 770ff86e7..9067945c7 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/sleep/es.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/sleep/es.json @@ -1,4 +1,11 @@ { + "qualities": { + "1": "Muy malo", + "2": "Malo", + "3": "Aceptable", + "4": "Bueno", + "5": "Muy bueno" + }, "list_view": { "cta_question": "¿Cómo dormiste?", "cta_action": "Registrar ahora", diff --git a/apps/mana/apps/web/src/lib/i18n/locales/sleep/fr.json b/apps/mana/apps/web/src/lib/i18n/locales/sleep/fr.json index 8ddd87ce6..46ec95728 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/sleep/fr.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/sleep/fr.json @@ -1,4 +1,11 @@ { + "qualities": { + "1": "Très mauvais", + "2": "Mauvais", + "3": "Correct", + "4": "Bon", + "5": "Très bon" + }, "list_view": { "cta_question": "Comment as-tu dormi ?", "cta_action": "Enregistrer maintenant", diff --git a/apps/mana/apps/web/src/lib/i18n/locales/sleep/it.json b/apps/mana/apps/web/src/lib/i18n/locales/sleep/it.json index 2b3854089..a09119054 100644 --- a/apps/mana/apps/web/src/lib/i18n/locales/sleep/it.json +++ b/apps/mana/apps/web/src/lib/i18n/locales/sleep/it.json @@ -1,4 +1,11 @@ { + "qualities": { + "1": "Pessimo", + "2": "Scarso", + "3": "Discreto", + "4": "Buono", + "5": "Ottimo" + }, "list_view": { "cta_question": "Come hai dormito?", "cta_action": "Registra ora", diff --git a/apps/mana/apps/web/src/lib/modules/sleep/ListView.svelte b/apps/mana/apps/web/src/lib/modules/sleep/ListView.svelte index 0e89daec7..b9cde43dd 100644 --- a/apps/mana/apps/web/src/lib/modules/sleep/ListView.svelte +++ b/apps/mana/apps/web/src/lib/modules/sleep/ListView.svelte @@ -22,9 +22,9 @@ formatDuration, formatTime, } from './queries'; - import { QUALITY_LABELS } from './types'; import MorningLog from './components/MorningLog.svelte'; import HygieneChecklist from './components/HygieneChecklist.svelte'; + import { _ } from 'svelte-i18n'; const entriesQuery = useAllSleepEntries(); const hygieneLogsQuery = useAllSleepHygieneLogs(); @@ -85,8 +85,8 @@ {#if !logged} {/if} @@ -94,9 +94,11 @@ {#if lastNight}
- Letzte Nacht + {$_('sleep.list_view.label_last_night')} {#if logged} - + {/if}
@@ -117,7 +119,11 @@ {/each} {#if lastNight.interruptions > 0} - {lastNight.interruptions}× aufgewacht + {$_('sleep.list_view.interruptions', { + values: { n: lastNight.interruptions }, + })} {/if}
@@ -129,7 +135,7 @@
- +
{#each weekData as day}
@@ -157,37 +163,42 @@
{formatDuration(avgDuration7)} - Ø Dauer (7T) + {$_('sleep.list_view.stat_avg_duration')}
{avgQuality7} - Ø Qualität + {$_('sleep.list_view.stat_avg_quality')}
0} >{sleepDebt > 0 ? '-' : '+'}{formatDuration(Math.abs(sleepDebt))} - Schlafschuld + {$_('sleep.list_view.stat_sleep_debt')}
{consistency}% - Konsistenz + {$_('sleep.list_view.stat_consistency')}
{streak} - Streak + {$_('sleep.list_view.stat_streak')}
- +
{#each heatmap as day}
0 ? qualityColor(day.quality) : ''} - title="{day.date}: {QUALITY_LABELS[day.quality]?.de ?? '—'}" + title={$_('sleep.list_view.heatmap_cell_title', { + values: { + date: day.date, + label: day.quality > 0 ? $_('sleep.qualities.' + day.quality) : '—', + }, + })} >
{/each}
@@ -196,13 +207,13 @@ {#if hygieneCorr}
- +
- Mit Hygiene (≥70%): + {$_('sleep.list_view.corr_with')} {hygieneCorr.withHygiene} ★
- Ohne: + {$_('sleep.list_view.corr_without')} {hygieneCorr.withoutHygiene} ★
@@ -210,9 +221,11 @@
- +
diff --git a/scripts/i18n-hardcoded-baseline.json b/scripts/i18n-hardcoded-baseline.json index fad802faf..73838e597 100644 --- a/scripts/i18n-hardcoded-baseline.json +++ b/scripts/i18n-hardcoded-baseline.json @@ -93,6 +93,7 @@ "apps/mana/apps/web/src/lib/modules/community/components/ItemCard.svelte": 1, "apps/mana/apps/web/src/lib/modules/community/views/DetailView.svelte": 1, "apps/mana/apps/web/src/lib/modules/community/views/ListView.svelte": 1, + "apps/mana/apps/web/src/lib/modules/community/views/MyWishesView.svelte": 6, "apps/mana/apps/web/src/lib/modules/community/views/RoadmapView.svelte": 1, "apps/mana/apps/web/src/lib/modules/companion/components/CompanionChat.svelte": 1, "apps/mana/apps/web/src/lib/modules/companion/components/RitualRunner.svelte": 5, @@ -174,7 +175,6 @@ "apps/mana/apps/web/src/lib/modules/skilltree/components/StatsOverview.svelte": 4, "apps/mana/apps/web/src/lib/modules/skilltree/views/DetailView.svelte": 5, "apps/mana/apps/web/src/lib/modules/sleep/components/MorningLog.svelte": 5, - "apps/mana/apps/web/src/lib/modules/sleep/ListView.svelte": 8, "apps/mana/apps/web/src/lib/modules/spaces/ListView.svelte": 6, "apps/mana/apps/web/src/lib/modules/storage/ListView.svelte": 2, "apps/mana/apps/web/src/lib/modules/storage/views/DetailView.svelte": 4, @@ -290,6 +290,7 @@ "apps/mana/apps/web/src/routes/(app)/presi/+page.svelte": 6, "apps/mana/apps/web/src/routes/(app)/presi/deck/[id]/+page.svelte": 6, "apps/mana/apps/web/src/routes/(app)/presi/present/[id]/+page.svelte": 2, + "apps/mana/apps/web/src/routes/(app)/profile/my-wishes/+page.svelte": 1, "apps/mana/apps/web/src/routes/(app)/questions/[id]/+page.svelte": 3, "apps/mana/apps/web/src/routes/(app)/questions/+page.svelte": 7, "apps/mana/apps/web/src/routes/(app)/questions/collections/+page.svelte": 1, diff --git a/scripts/i18n-missing-baseline.json b/scripts/i18n-missing-baseline.json index d8c6c8740..274ecb94b 100644 --- a/scripts/i18n-missing-baseline.json +++ b/scripts/i18n-missing-baseline.json @@ -22,6 +22,7 @@ "apps/mana/apps/web/src/lib/modules/quiz/EditView.svelte": 1, "apps/mana/apps/web/src/lib/modules/quotes/components/QuoteCard.svelte": 4, "apps/mana/apps/web/src/lib/modules/recipes/ListView.svelte": 1, + "apps/mana/apps/web/src/lib/modules/sleep/ListView.svelte": 1, "apps/mana/apps/web/src/lib/modules/times/components/EntryForm.svelte": 6, "apps/mana/apps/web/src/lib/modules/times/components/EntryItem.svelte": 6, "apps/mana/apps/web/src/lib/modules/times/components/EntryList.svelte": 2,