diff --git a/messages/de.json b/messages/de.json index 88584d7d5..98a22e99b 100644 --- a/messages/de.json +++ b/messages/de.json @@ -1081,6 +1081,7 @@ "description": "Phasen-Aufschlüsselung und nächtliche Dauer – gezogen aus Apple Health.", "headlineTitle": "Durchschnitt pro Nacht", "headlineCaption": "Gemittelt über {count} Nächte – {suffix}", + "headlineCaptionSuffix": "pro Nacht", "compositionTitle": "Phasen-Verteilung", "compositionSubtitle": "Letzte {nights} Nächte", "compositionAriaLabel": "Schlafphasen-Verteilung über {nights} Nächte", diff --git a/messages/en.json b/messages/en.json index 296f81685..c63da8fa7 100644 --- a/messages/en.json +++ b/messages/en.json @@ -1081,6 +1081,7 @@ "description": "Stage breakdown and nightly duration, drawn from Apple Health.", "headlineTitle": "Average per night", "headlineCaption": "Averaged across {count} nights — {suffix}", + "headlineCaptionSuffix": "per night", "compositionTitle": "Stage composition", "compositionSubtitle": "Last {nights} nights", "compositionAriaLabel": "Sleep stage composition over {nights} nights", diff --git a/messages/es.json b/messages/es.json index 55e3b9aff..dcefbb9f9 100644 --- a/messages/es.json +++ b/messages/es.json @@ -1081,6 +1081,7 @@ "description": "Stage breakdown and nightly duration, drawn from Apple Health.", "headlineTitle": "Average per night", "headlineCaption": "Averaged across {count} nights — {suffix}", + "headlineCaptionSuffix": "por noche", "compositionTitle": "Stage composition", "compositionSubtitle": "Last {nights} nights", "compositionAriaLabel": "Sleep stage composition over {nights} nights", diff --git a/messages/fr.json b/messages/fr.json index e2546ef47..f51755eda 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -1081,6 +1081,7 @@ "description": "Stage breakdown and nightly duration, drawn from Apple Health.", "headlineTitle": "Average per night", "headlineCaption": "Averaged across {count} nights — {suffix}", + "headlineCaptionSuffix": "par nuit", "compositionTitle": "Stage composition", "compositionSubtitle": "Last {nights} nights", "compositionAriaLabel": "Sleep stage composition over {nights} nights", diff --git a/messages/it.json b/messages/it.json index 9e8847268..67b02a25b 100644 --- a/messages/it.json +++ b/messages/it.json @@ -1081,6 +1081,7 @@ "description": "Stage breakdown and nightly duration, drawn from Apple Health.", "headlineTitle": "Average per night", "headlineCaption": "Averaged across {count} nights — {suffix}", + "headlineCaptionSuffix": "per notte", "compositionTitle": "Stage composition", "compositionSubtitle": "Last {nights} nights", "compositionAriaLabel": "Sleep stage composition over {nights} nights", diff --git a/messages/pl.json b/messages/pl.json index 1e2f66193..f2a472673 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -1081,6 +1081,7 @@ "description": "Stage breakdown and nightly duration, drawn from Apple Health.", "headlineTitle": "Average per night", "headlineCaption": "Averaged across {count} nights — {suffix}", + "headlineCaptionSuffix": "na noc", "compositionTitle": "Stage composition", "compositionSubtitle": "Last {nights} nights", "compositionAriaLabel": "Sleep stage composition over {nights} nights", diff --git a/src/components/insights/sleep-overview.tsx b/src/components/insights/sleep-overview.tsx index 83648ae56..dd46e17a8 100644 --- a/src/components/insights/sleep-overview.tsx +++ b/src/components/insights/sleep-overview.tsx @@ -53,19 +53,13 @@ interface SleepAnalyticsResponse { function formatHoursMinutes( totalMinutes: number, locale: string, -): { primary: string; suffix: string } { +): { primary: string } { const hours = Math.floor(totalMinutes / 60); const mins = Math.round(totalMinutes - hours * 60); if (locale === "de") { - return { - primary: `${hours} Std. ${mins} Min.`, - suffix: "pro Nacht", - }; + return { primary: `${hours} Std. ${mins} Min.` }; } - return { - primary: `${hours}h ${mins}m`, - suffix: "per night", - }; + return { primary: `${hours}h ${mins}m` }; } export function SleepOverview() { @@ -106,10 +100,11 @@ export function SleepOverview() { } const averageMinutes = sleepSummary?.avg30 ?? sleepSummary?.avg7 ?? null; - const { primary, suffix } = + const suffix = t("insights.sleep.headlineCaptionSuffix"); + const { primary } = averageMinutes != null ? formatHoursMinutes(averageMinutes, locale) - : { primary: "—", suffix: "" }; + : { primary: "—" }; return (