mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
feat(i18n): add notification, insights empty-state, and admin carrier keys plus drift-guard
Lands every new translation key referenced by the v1.4.27 buckets B1,
B3, B4 and B5 across all six locale bundles (38 keys per locale):
- dashboard.glp1.tabLevel / tabWeight / tabsAria / rangeStripLabel /
levelUnavailable / weightUnavailable (B1 — drug-level vs weight tab
strip on the GLP-1 dashboard tile).
- admin.carrier / admin.carrierUnknown (B3 — IP-address carrier chip
on the admin login overview).
- insights.emptyState.{bloodPressure,weight,pulse,bmi,mood,medication,sleep}.{title,description,cta}
(B4 — per-metric empty-state cards on the insights sub-pages).
- notifications.admin.{deployFailedTitle,deployFailedBody,testNotificationTitle,testNotificationBody,reminderCheckMissedTitle,reminderCheckMissedBody,reminderCheckOverdueTitle,reminderCheckOverdueBody}
(B5 — admin notification messages routed through the localised
dispatch helper).
- notifications.user.telegramTestBody (B5 — user-facing Telegram test
message localised to User.locale).
Also retires the now-dead charts.moodLabel1..5 chart-axis label keys:
the mood chart and the mood list now consume the same MOOD_LABEL_KEYS
map from a new src/lib/mood/labels.ts so the chart-axis copy stays in
lockstep with the list (BL-P6-11). Three distinct copy sets for the
same five mood states drifted twice during v1.4.18 / v1.4.25
polishing; the shared resolver locks them together going forward.
New drift-guard test at src/__tests__/i18n-drift-guard.test.ts pins
the GLP-1 tab, admin carrier, insights empty-state, admin/user
notification, and personal-record key sets so a contributor who only
edits one bundle gets a precise failure instead of a 200-line parity
diff. The locale-integrity test continues to assert global parity;
the drift-guard layers on top with call-site-specific coverage.
This commit is contained in:
1 parent
32a023dfff
commit
22b11427e8
10 files changed
+653
-76
No files matched your search
+62
-9
@@ -264,7 +264,13 @@
|
||||
"lastInjection": "Letzte Injektion",
|
||||
"nextInjection": "Nächste Injektion",
|
||||
"weightDelta": "seit Beginn",
|
||||
"inDays": "in {count} Tagen"
|
||||
"inDays": "in {count} Tagen",
|
||||
"tabLevel": "Spiegel",
|
||||
"tabWeight": "Gewicht",
|
||||
"tabsAria": "Wirkstoffspiegel oder Gewichtsverlauf anzeigen",
|
||||
"rangeStripLabel": "Zeitraum auswählen",
|
||||
"levelUnavailable": "Spiegel noch nicht verfügbar — Dosis loggen, dann erscheint die Kurve.",
|
||||
"weightUnavailable": "Gewichtsverlauf noch nicht verfügbar — Messung erfassen, um den Verlauf zu sehen."
|
||||
}
|
||||
},
|
||||
"measurements": {
|
||||
@@ -825,11 +831,6 @@
|
||||
"colorRed": "Rot:",
|
||||
"mood": "Stimmung",
|
||||
"moodScore": "Stimmungswert",
|
||||
"moodLabel1": "Lausig",
|
||||
"moodLabel2": "Schlecht",
|
||||
"moodLabel3": "Okay",
|
||||
"moodLabel4": "Gut",
|
||||
"moodLabel5": "Super",
|
||||
"weekdays": {
|
||||
"mon": "Mo",
|
||||
"wed": "Mi",
|
||||
@@ -1232,7 +1233,44 @@
|
||||
"generate": "Neue Analyse erstellen",
|
||||
"moodSectionTitle": "Stimmung",
|
||||
"confidence": "Konfidenz",
|
||||
"cached": "Gecacht"
|
||||
"cached": "Gecacht",
|
||||
"emptyState": {
|
||||
"bloodPressure": {
|
||||
"title": "Noch keine Blutdruckwerte",
|
||||
"description": "Sobald du Blutdruck loggst, erscheinen hier Trend, Zielbereichs-Anteil und WHO-Klassifizierung.",
|
||||
"cta": "Blutdruck loggen"
|
||||
},
|
||||
"weight": {
|
||||
"title": "Noch keine Gewichtswerte",
|
||||
"description": "Logge ein Gewicht, und Verlauf, gleitender Durchschnitt und Zielbereich erscheinen automatisch.",
|
||||
"cta": "Gewicht loggen"
|
||||
},
|
||||
"pulse": {
|
||||
"title": "Noch keine Pulswerte",
|
||||
"description": "Logge einen Puls, dann erscheinen Ruhepuls, HRV und VO₂ max in dieser Ansicht.",
|
||||
"cta": "Puls loggen"
|
||||
},
|
||||
"bmi": {
|
||||
"title": "BMI noch nicht berechnet",
|
||||
"description": "Sobald Größe und mindestens ein Gewichtswert vorliegen, erscheint hier der BMI-Verlauf samt WHO-Zonen.",
|
||||
"cta": "Gewicht loggen"
|
||||
},
|
||||
"mood": {
|
||||
"title": "Noch keine Stimmungseinträge",
|
||||
"description": "Logge eine Stimmung, dann erscheinen Verlauf, Stabilitätsband und Korrelationen.",
|
||||
"cta": "Stimmung loggen"
|
||||
},
|
||||
"medication": {
|
||||
"title": "Noch keine Medikamente angelegt",
|
||||
"description": "Lege ein Medikament an, dann erscheinen Einnahme-Compliance, Wirkstoffspiegel und Eskalations-Verlauf.",
|
||||
"cta": "Medikament hinzufügen"
|
||||
},
|
||||
"sleep": {
|
||||
"title": "Noch keine Schlafwerte",
|
||||
"description": "Sobald Schlafdaten vorliegen (manuell oder via Withings / Apple Health), erscheint hier der nächtliche Stadien-Verlauf.",
|
||||
"cta": "Withings verbinden"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"defaultLabel": "Default",
|
||||
@@ -2286,7 +2324,9 @@
|
||||
"title": "Gefahrenzone",
|
||||
"subtitle": "Destruktive systemweite Operationen."
|
||||
}
|
||||
}
|
||||
},
|
||||
"carrier": "Anbieter",
|
||||
"carrierUnknown": "Unbekannter Anbieter"
|
||||
},
|
||||
"achievements": {
|
||||
"title": "Erfolge",
|
||||
@@ -2596,7 +2636,20 @@
|
||||
"loadError": "Benachrichtigungseinstellungen konnten nicht geladen werden.",
|
||||
"noChannels": "Konfiguriere zuerst einen Benachrichtigungskanal in den Einstellungen.",
|
||||
"goToSettings": "Zu den Einstellungen",
|
||||
"channelDisabled": "Deaktiviert"
|
||||
"channelDisabled": "Deaktiviert",
|
||||
"admin": {
|
||||
"deployFailedTitle": "Bereitstellung fehlgeschlagen: {application}",
|
||||
"deployFailedBody": "Bei der Bereitstellung von {application} (#{deployment}) ist ein Fehler aufgetreten: {error}. Logs ansehen: {logsUrl}",
|
||||
"testNotificationTitle": "HealthLog Test-Benachrichtigung",
|
||||
"testNotificationBody": "Diese Test-Benachrichtigung wurde vom Admin-Panel ausgelöst. Wenn du sie siehst, funktioniert der Kanal.",
|
||||
"reminderCheckMissedTitle": "Erinnerung verpasst: {medication}",
|
||||
"reminderCheckMissedBody": "{medication} ({dose}) im Zeitfenster {window} wurde nicht geloggt.",
|
||||
"reminderCheckOverdueTitle": "Einnahme überfällig: {medication}",
|
||||
"reminderCheckOverdueBody": "{medication} ({dose}) im Zeitfenster {window} ist seit {minutes} Minuten überfällig."
|
||||
},
|
||||
"user": {
|
||||
"telegramTestBody": "HealthLog: Verbindung hergestellt. Telegram-Benachrichtigungen sind aktiv."
|
||||
}
|
||||
},
|
||||
"i18n": {
|
||||
"maintainershipBanner": {
|
||||
|
||||
+62
-9
@@ -264,7 +264,13 @@
|
||||
"lastInjection": "Last injection",
|
||||
"nextInjection": "Next injection",
|
||||
"weightDelta": "since start",
|
||||
"inDays": "in {count} days"
|
||||
"inDays": "in {count} days",
|
||||
"tabLevel": "Level",
|
||||
"tabWeight": "Weight",
|
||||
"tabsAria": "Switch between drug-level and weight views",
|
||||
"rangeStripLabel": "Select range",
|
||||
"levelUnavailable": "Drug level not yet available — log a dose and the curve will appear.",
|
||||
"weightUnavailable": "Weight trend not yet available — log a measurement to see the trend."
|
||||
}
|
||||
},
|
||||
"measurements": {
|
||||
@@ -825,11 +831,6 @@
|
||||
"colorRed": "Red:",
|
||||
"mood": "Mood",
|
||||
"moodScore": "Mood Score",
|
||||
"moodLabel1": "Awful",
|
||||
"moodLabel2": "Bad",
|
||||
"moodLabel3": "Okay",
|
||||
"moodLabel4": "Good",
|
||||
"moodLabel5": "Great",
|
||||
"weekdays": {
|
||||
"mon": "Mon",
|
||||
"wed": "Wed",
|
||||
@@ -1232,7 +1233,44 @@
|
||||
"generate": "Generate new analysis",
|
||||
"moodSectionTitle": "Mood",
|
||||
"confidence": "Confidence",
|
||||
"cached": "Cached"
|
||||
"cached": "Cached",
|
||||
"emptyState": {
|
||||
"bloodPressure": {
|
||||
"title": "No blood pressure entries yet",
|
||||
"description": "Log a blood pressure reading and the trend chart, in-range share, and WHO classification will appear here.",
|
||||
"cta": "Log blood pressure"
|
||||
},
|
||||
"weight": {
|
||||
"title": "No weight entries yet",
|
||||
"description": "Log a weight and the trend, moving average, and target band will appear automatically.",
|
||||
"cta": "Log weight"
|
||||
},
|
||||
"pulse": {
|
||||
"title": "No pulse entries yet",
|
||||
"description": "Log a pulse reading and resting pulse, HRV and VO₂ max will appear in this view.",
|
||||
"cta": "Log pulse"
|
||||
},
|
||||
"bmi": {
|
||||
"title": "BMI not yet computed",
|
||||
"description": "Once height and at least one weight entry are present, the BMI trend with WHO zones will appear here.",
|
||||
"cta": "Log weight"
|
||||
},
|
||||
"mood": {
|
||||
"title": "No mood entries yet",
|
||||
"description": "Log a mood entry and the trend, stability band and correlations will appear.",
|
||||
"cta": "Log mood"
|
||||
},
|
||||
"medication": {
|
||||
"title": "No medications set up yet",
|
||||
"description": "Set up a medication and intake compliance, drug level and titration timeline will appear here.",
|
||||
"cta": "Add medication"
|
||||
},
|
||||
"sleep": {
|
||||
"title": "No sleep entries yet",
|
||||
"description": "Once sleep data lands (manual or via Withings / Apple Health), the per-night stage breakdown will appear here.",
|
||||
"cta": "Connect Withings"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"defaultLabel": "Default",
|
||||
@@ -2286,7 +2324,9 @@
|
||||
"title": "Danger Zone",
|
||||
"subtitle": "Destructive system-wide operations."
|
||||
}
|
||||
}
|
||||
},
|
||||
"carrier": "Carrier",
|
||||
"carrierUnknown": "Unknown carrier"
|
||||
},
|
||||
"achievements": {
|
||||
"title": "Achievements",
|
||||
@@ -2596,7 +2636,20 @@
|
||||
"loadError": "Notification preferences could not be loaded.",
|
||||
"noChannels": "Configure a notification channel in Settings first.",
|
||||
"goToSettings": "Go to Settings",
|
||||
"channelDisabled": "Disabled"
|
||||
"channelDisabled": "Disabled",
|
||||
"admin": {
|
||||
"deployFailedTitle": "Deployment failed: {application}",
|
||||
"deployFailedBody": "An error occurred while deploying {application} (#{deployment}): {error}. View logs: {logsUrl}",
|
||||
"testNotificationTitle": "HealthLog test notification",
|
||||
"testNotificationBody": "This test notification was triggered from the admin panel. If you can see it, the channel is working.",
|
||||
"reminderCheckMissedTitle": "Reminder missed: {medication}",
|
||||
"reminderCheckMissedBody": "{medication} ({dose}) was not logged in the {window} window.",
|
||||
"reminderCheckOverdueTitle": "Dose overdue: {medication}",
|
||||
"reminderCheckOverdueBody": "{medication} ({dose}) in the {window} window is {minutes} minutes overdue."
|
||||
},
|
||||
"user": {
|
||||
"telegramTestBody": "HealthLog: connection successful. Telegram notifications are active."
|
||||
}
|
||||
},
|
||||
"i18n": {
|
||||
"maintainershipBanner": {
|
||||
|
||||
+62
-9
@@ -264,7 +264,13 @@
|
||||
"lastInjection": "Last injection",
|
||||
"nextInjection": "Next injection",
|
||||
"weightDelta": "since start",
|
||||
"inDays": "in {count} days"
|
||||
"inDays": "in {count} days",
|
||||
"tabLevel": "Nivel",
|
||||
"tabWeight": "Peso",
|
||||
"tabsAria": "Cambiar entre vista de nivel y vista de peso",
|
||||
"rangeStripLabel": "Seleccionar rango",
|
||||
"levelUnavailable": "Nivel no disponible aún — registra una dosis y la curva aparecerá.",
|
||||
"weightUnavailable": "Tendencia de peso no disponible aún — registra una medición para verla."
|
||||
}
|
||||
},
|
||||
"measurements": {
|
||||
@@ -825,11 +831,6 @@
|
||||
"colorRed": "Red:",
|
||||
"mood": "Estado de ánimo",
|
||||
"moodScore": "Mood Score",
|
||||
"moodLabel1": "Terrible",
|
||||
"moodLabel2": "Mal",
|
||||
"moodLabel3": "Okay",
|
||||
"moodLabel4": "Bien",
|
||||
"moodLabel5": "Excelente",
|
||||
"weekdays": {
|
||||
"mon": "Mon",
|
||||
"wed": "Wed",
|
||||
@@ -1232,7 +1233,44 @@
|
||||
"generate": "Generate new analysis",
|
||||
"moodSectionTitle": "Estado de ánimo",
|
||||
"confidence": "Confidence",
|
||||
"cached": "Cached"
|
||||
"cached": "Cached",
|
||||
"emptyState": {
|
||||
"bloodPressure": {
|
||||
"title": "Aún no hay registros de presión arterial",
|
||||
"description": "Registra una medición de presión y aquí aparecerán la tendencia, el porcentaje en rango y la clasificación de la OMS.",
|
||||
"cta": "Registrar presión"
|
||||
},
|
||||
"weight": {
|
||||
"title": "Aún no hay registros de peso",
|
||||
"description": "Registra un peso y aparecerán automáticamente la tendencia, la media móvil y la zona objetivo.",
|
||||
"cta": "Registrar peso"
|
||||
},
|
||||
"pulse": {
|
||||
"title": "Aún no hay registros de pulso",
|
||||
"description": "Registra un pulso y aquí aparecerán pulso en reposo, VFC y VO₂ máx.",
|
||||
"cta": "Registrar pulso"
|
||||
},
|
||||
"bmi": {
|
||||
"title": "IMC aún no calculado",
|
||||
"description": "Cuando haya altura y al menos un registro de peso, aquí aparecerá la tendencia del IMC con las zonas de la OMS.",
|
||||
"cta": "Registrar peso"
|
||||
},
|
||||
"mood": {
|
||||
"title": "Aún no hay entradas de estado de ánimo",
|
||||
"description": "Registra un estado de ánimo y aparecerán la tendencia, la banda de estabilidad y las correlaciones.",
|
||||
"cta": "Registrar ánimo"
|
||||
},
|
||||
"medication": {
|
||||
"title": "Aún no hay medicamentos configurados",
|
||||
"description": "Configura un medicamento y aquí aparecerán la adherencia, el nivel plasmático y la titulación.",
|
||||
"cta": "Añadir medicamento"
|
||||
},
|
||||
"sleep": {
|
||||
"title": "Aún no hay registros de sueño",
|
||||
"description": "Una vez disponibles los datos de sueño (manual o vía Withings / Apple Health), aquí aparecerá el desglose por fases.",
|
||||
"cta": "Conectar Withings"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"defaultLabel": "Default",
|
||||
@@ -2286,7 +2324,9 @@
|
||||
"title": "Danger Zone",
|
||||
"subtitle": "Destructive system-wide operations."
|
||||
}
|
||||
}
|
||||
},
|
||||
"carrier": "Operador",
|
||||
"carrierUnknown": "Operador desconocido"
|
||||
},
|
||||
"achievements": {
|
||||
"title": "Achievements",
|
||||
@@ -2596,7 +2636,20 @@
|
||||
"loadError": "Notification preferences could not be loaded.",
|
||||
"noChannels": "Configure a notification channel in Settings first.",
|
||||
"goToSettings": "Go to Settings",
|
||||
"channelDisabled": "Desactivado"
|
||||
"channelDisabled": "Desactivado",
|
||||
"admin": {
|
||||
"deployFailedTitle": "Despliegue fallido: {application}",
|
||||
"deployFailedBody": "Se produjo un error al desplegar {application} (#{deployment}): {error}. Ver registros: {logsUrl}",
|
||||
"testNotificationTitle": "HealthLog notificación de prueba",
|
||||
"testNotificationBody": "Esta notificación de prueba se activó desde el panel de administración. Si la ves, el canal funciona.",
|
||||
"reminderCheckMissedTitle": "Recordatorio perdido: {medication}",
|
||||
"reminderCheckMissedBody": "{medication} ({dose}) no se registró en la ventana {window}.",
|
||||
"reminderCheckOverdueTitle": "Dosis atrasada: {medication}",
|
||||
"reminderCheckOverdueBody": "{medication} ({dose}) en la ventana {window} lleva {minutes} minutos de retraso."
|
||||
},
|
||||
"user": {
|
||||
"telegramTestBody": "HealthLog: conexión correcta. Las notificaciones de Telegram están activas."
|
||||
}
|
||||
},
|
||||
"i18n": {
|
||||
"maintainershipBanner": {
|
||||
|
||||
+62
-9
@@ -264,7 +264,13 @@
|
||||
"lastInjection": "Last injection",
|
||||
"nextInjection": "Next injection",
|
||||
"weightDelta": "since start",
|
||||
"inDays": "in {count} days"
|
||||
"inDays": "in {count} days",
|
||||
"tabLevel": "Taux",
|
||||
"tabWeight": "Poids",
|
||||
"tabsAria": "Basculer entre la vue taux et la vue poids",
|
||||
"rangeStripLabel": "Sélectionner la période",
|
||||
"levelUnavailable": "Taux indisponible — enregistrez une dose pour afficher la courbe.",
|
||||
"weightUnavailable": "Tendance de poids indisponible — enregistrez une mesure pour la voir."
|
||||
}
|
||||
},
|
||||
"measurements": {
|
||||
@@ -825,11 +831,6 @@
|
||||
"colorRed": "Red:",
|
||||
"mood": "Humeur",
|
||||
"moodScore": "Mood Score",
|
||||
"moodLabel1": "Terrible",
|
||||
"moodLabel2": "Mauvais",
|
||||
"moodLabel3": "Okay",
|
||||
"moodLabel4": "Bien",
|
||||
"moodLabel5": "Excellent",
|
||||
"weekdays": {
|
||||
"mon": "Mon",
|
||||
"wed": "Wed",
|
||||
@@ -1232,7 +1233,44 @@
|
||||
"generate": "Generate new analysis",
|
||||
"moodSectionTitle": "Humeur",
|
||||
"confidence": "Confidence",
|
||||
"cached": "Cached"
|
||||
"cached": "Cached",
|
||||
"emptyState": {
|
||||
"bloodPressure": {
|
||||
"title": "Aucune mesure de tension artérielle",
|
||||
"description": "Enregistrez une mesure de tension : la tendance, la part dans la cible et la classification OMS s'afficheront ici.",
|
||||
"cta": "Enregistrer une tension"
|
||||
},
|
||||
"weight": {
|
||||
"title": "Aucune mesure de poids",
|
||||
"description": "Enregistrez un poids : la tendance, la moyenne glissante et la zone cible apparaîtront automatiquement.",
|
||||
"cta": "Enregistrer un poids"
|
||||
},
|
||||
"pulse": {
|
||||
"title": "Aucune mesure de pouls",
|
||||
"description": "Enregistrez un pouls : pouls au repos, VFC et VO₂ max apparaîtront dans cette vue.",
|
||||
"cta": "Enregistrer un pouls"
|
||||
},
|
||||
"bmi": {
|
||||
"title": "IMC pas encore calculé",
|
||||
"description": "Dès qu'une taille et au moins un poids sont enregistrés, la tendance IMC avec les zones OMS s'affichera ici.",
|
||||
"cta": "Enregistrer un poids"
|
||||
},
|
||||
"mood": {
|
||||
"title": "Aucune entrée d'humeur",
|
||||
"description": "Enregistrez une humeur : la tendance, la bande de stabilité et les corrélations s'afficheront.",
|
||||
"cta": "Enregistrer une humeur"
|
||||
},
|
||||
"medication": {
|
||||
"title": "Aucun médicament configuré",
|
||||
"description": "Configurez un médicament : observance, taux plasmatique et titration apparaîtront ici.",
|
||||
"cta": "Ajouter un médicament"
|
||||
},
|
||||
"sleep": {
|
||||
"title": "Aucune donnée de sommeil",
|
||||
"description": "Dès que des données de sommeil sont disponibles (manuel ou via Withings / Apple Health), la répartition par stade apparaîtra ici.",
|
||||
"cta": "Connecter Withings"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"defaultLabel": "Default",
|
||||
@@ -2286,7 +2324,9 @@
|
||||
"title": "Danger Zone",
|
||||
"subtitle": "Destructive system-wide operations."
|
||||
}
|
||||
}
|
||||
},
|
||||
"carrier": "Opérateur",
|
||||
"carrierUnknown": "Opérateur inconnu"
|
||||
},
|
||||
"achievements": {
|
||||
"title": "Achievements",
|
||||
@@ -2596,7 +2636,20 @@
|
||||
"loadError": "Notification preferences could not be loaded.",
|
||||
"noChannels": "Configure a notification channel in Settings first.",
|
||||
"goToSettings": "Go to Settings",
|
||||
"channelDisabled": "Désactivé"
|
||||
"channelDisabled": "Désactivé",
|
||||
"admin": {
|
||||
"deployFailedTitle": "Échec du déploiement : {application}",
|
||||
"deployFailedBody": "Une erreur est survenue lors du déploiement de {application} (#{deployment}) : {error}. Voir les journaux : {logsUrl}",
|
||||
"testNotificationTitle": "HealthLog notification de test",
|
||||
"testNotificationBody": "Cette notification de test a été déclenchée depuis le panneau d'administration. Si vous la voyez, le canal fonctionne.",
|
||||
"reminderCheckMissedTitle": "Rappel manqué : {medication}",
|
||||
"reminderCheckMissedBody": "{medication} ({dose}) n'a pas été enregistré dans la fenêtre {window}.",
|
||||
"reminderCheckOverdueTitle": "Prise en retard : {medication}",
|
||||
"reminderCheckOverdueBody": "{medication} ({dose}) dans la fenêtre {window} est en retard de {minutes} minutes."
|
||||
},
|
||||
"user": {
|
||||
"telegramTestBody": "HealthLog: connexion réussie. Les notifications Telegram sont actives."
|
||||
}
|
||||
},
|
||||
"i18n": {
|
||||
"maintainershipBanner": {
|
||||
|
||||
+62
-9
@@ -264,7 +264,13 @@
|
||||
"lastInjection": "Last injection",
|
||||
"nextInjection": "Next injection",
|
||||
"weightDelta": "since start",
|
||||
"inDays": "in {count} days"
|
||||
"inDays": "in {count} days",
|
||||
"tabLevel": "Livello",
|
||||
"tabWeight": "Peso",
|
||||
"tabsAria": "Passa tra vista del livello e vista del peso",
|
||||
"rangeStripLabel": "Seleziona intervallo",
|
||||
"levelUnavailable": "Livello non ancora disponibile — registra una dose e la curva apparirà.",
|
||||
"weightUnavailable": "Andamento del peso non ancora disponibile — registra una misurazione per vederlo."
|
||||
}
|
||||
},
|
||||
"measurements": {
|
||||
@@ -825,11 +831,6 @@
|
||||
"colorRed": "Red:",
|
||||
"mood": "Umore",
|
||||
"moodScore": "Mood Score",
|
||||
"moodLabel1": "Pessimo",
|
||||
"moodLabel2": "Male",
|
||||
"moodLabel3": "Okay",
|
||||
"moodLabel4": "Bene",
|
||||
"moodLabel5": "Ottimo",
|
||||
"weekdays": {
|
||||
"mon": "Mon",
|
||||
"wed": "Wed",
|
||||
@@ -1232,7 +1233,44 @@
|
||||
"generate": "Generate new analysis",
|
||||
"moodSectionTitle": "Umore",
|
||||
"confidence": "Confidence",
|
||||
"cached": "Cached"
|
||||
"cached": "Cached",
|
||||
"emptyState": {
|
||||
"bloodPressure": {
|
||||
"title": "Nessuna misurazione della pressione",
|
||||
"description": "Registra una misurazione e qui appariranno l'andamento, la percentuale in target e la classificazione OMS.",
|
||||
"cta": "Registra pressione"
|
||||
},
|
||||
"weight": {
|
||||
"title": "Nessuna misurazione del peso",
|
||||
"description": "Registra un peso: andamento, media mobile e fascia obiettivo appariranno automaticamente.",
|
||||
"cta": "Registra peso"
|
||||
},
|
||||
"pulse": {
|
||||
"title": "Nessuna misurazione del polso",
|
||||
"description": "Registra una misurazione: polso a riposo, HRV e VO₂ max appariranno in questa vista.",
|
||||
"cta": "Registra polso"
|
||||
},
|
||||
"bmi": {
|
||||
"title": "BMI non ancora calcolato",
|
||||
"description": "Una volta inseriti altezza e almeno un peso, qui apparirà l'andamento del BMI con le zone OMS.",
|
||||
"cta": "Registra peso"
|
||||
},
|
||||
"mood": {
|
||||
"title": "Nessuna voce d'umore",
|
||||
"description": "Registra un umore: appariranno andamento, fascia di stabilità e correlazioni.",
|
||||
"cta": "Registra umore"
|
||||
},
|
||||
"medication": {
|
||||
"title": "Nessun farmaco configurato",
|
||||
"description": "Configura un farmaco: aderenza, livello plasmatico e titolazione appariranno qui.",
|
||||
"cta": "Aggiungi farmaco"
|
||||
},
|
||||
"sleep": {
|
||||
"title": "Nessuna voce di sonno",
|
||||
"description": "Quando saranno disponibili dati sul sonno (manuale o tramite Withings / Apple Health), qui apparirà la suddivisione per fase.",
|
||||
"cta": "Collega Withings"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"defaultLabel": "Default",
|
||||
@@ -2286,7 +2324,9 @@
|
||||
"title": "Danger Zone",
|
||||
"subtitle": "Destructive system-wide operations."
|
||||
}
|
||||
}
|
||||
},
|
||||
"carrier": "Operatore",
|
||||
"carrierUnknown": "Operatore sconosciuto"
|
||||
},
|
||||
"achievements": {
|
||||
"title": "Achievements",
|
||||
@@ -2596,7 +2636,20 @@
|
||||
"loadError": "Notification preferences could not be loaded.",
|
||||
"noChannels": "Configure a notification channel in Settings first.",
|
||||
"goToSettings": "Go to Settings",
|
||||
"channelDisabled": "Disabilitato"
|
||||
"channelDisabled": "Disabilitato",
|
||||
"admin": {
|
||||
"deployFailedTitle": "Distribuzione fallita: {application}",
|
||||
"deployFailedBody": "Si è verificato un errore durante la distribuzione di {application} (#{deployment}): {error}. Vedi log: {logsUrl}",
|
||||
"testNotificationTitle": "HealthLog notifica di prova",
|
||||
"testNotificationBody": "Questa notifica di prova è stata attivata dal pannello di amministrazione. Se la vedi, il canale funziona.",
|
||||
"reminderCheckMissedTitle": "Promemoria perso: {medication}",
|
||||
"reminderCheckMissedBody": "{medication} ({dose}) non è stato registrato nella finestra {window}.",
|
||||
"reminderCheckOverdueTitle": "Dose in ritardo: {medication}",
|
||||
"reminderCheckOverdueBody": "{medication} ({dose}) nella finestra {window} è in ritardo di {minutes} minuti."
|
||||
},
|
||||
"user": {
|
||||
"telegramTestBody": "HealthLog: connessione riuscita. Le notifiche Telegram sono attive."
|
||||
}
|
||||
},
|
||||
"i18n": {
|
||||
"maintainershipBanner": {
|
||||
|
||||
+62
-9
@@ -264,7 +264,13 @@
|
||||
"lastInjection": "Last injection",
|
||||
"nextInjection": "Next injection",
|
||||
"weightDelta": "since start",
|
||||
"inDays": "in {count} days"
|
||||
"inDays": "in {count} days",
|
||||
"tabLevel": "Poziom",
|
||||
"tabWeight": "Waga",
|
||||
"tabsAria": "Przełącz między widokiem poziomu i widokiem wagi",
|
||||
"rangeStripLabel": "Wybierz zakres",
|
||||
"levelUnavailable": "Poziom jeszcze niedostępny — zarejestruj dawkę, a krzywa się pojawi.",
|
||||
"weightUnavailable": "Trend wagi jeszcze niedostępny — zarejestruj pomiar, aby go zobaczyć."
|
||||
}
|
||||
},
|
||||
"measurements": {
|
||||
@@ -825,11 +831,6 @@
|
||||
"colorRed": "Red:",
|
||||
"mood": "Nastrój",
|
||||
"moodScore": "Mood Score",
|
||||
"moodLabel1": "Okropnie",
|
||||
"moodLabel2": "Źle",
|
||||
"moodLabel3": "Okay",
|
||||
"moodLabel4": "Dobrze",
|
||||
"moodLabel5": "Świetnie",
|
||||
"weekdays": {
|
||||
"mon": "Mon",
|
||||
"wed": "Wed",
|
||||
@@ -1232,7 +1233,44 @@
|
||||
"generate": "Generate new analysis",
|
||||
"moodSectionTitle": "Nastrój",
|
||||
"confidence": "Confidence",
|
||||
"cached": "Cached"
|
||||
"cached": "Cached",
|
||||
"emptyState": {
|
||||
"bloodPressure": {
|
||||
"title": "Brak pomiarów ciśnienia krwi",
|
||||
"description": "Zarejestruj pomiar ciśnienia, a pojawi się tu trend, udział w zakresie docelowym i klasyfikacja WHO.",
|
||||
"cta": "Zarejestruj ciśnienie"
|
||||
},
|
||||
"weight": {
|
||||
"title": "Brak pomiarów wagi",
|
||||
"description": "Zarejestruj wagę, a trend, średnia krocząca i zakres docelowy pojawią się automatycznie.",
|
||||
"cta": "Zarejestruj wagę"
|
||||
},
|
||||
"pulse": {
|
||||
"title": "Brak pomiarów tętna",
|
||||
"description": "Zarejestruj tętno, a w tym widoku pojawi się tętno spoczynkowe, HRV i VO₂ max.",
|
||||
"cta": "Zarejestruj tętno"
|
||||
},
|
||||
"bmi": {
|
||||
"title": "BMI jeszcze nie obliczone",
|
||||
"description": "Po wpisaniu wzrostu i co najmniej jednej wagi pojawi się tu trend BMI z zakresami WHO.",
|
||||
"cta": "Zarejestruj wagę"
|
||||
},
|
||||
"mood": {
|
||||
"title": "Brak wpisów nastroju",
|
||||
"description": "Zarejestruj nastrój, a pojawi się trend, pasmo stabilności i korelacje.",
|
||||
"cta": "Zarejestruj nastrój"
|
||||
},
|
||||
"medication": {
|
||||
"title": "Brak skonfigurowanych leków",
|
||||
"description": "Skonfiguruj lek, a pojawi się adherencja, poziom we krwi i schemat titracji.",
|
||||
"cta": "Dodaj lek"
|
||||
},
|
||||
"sleep": {
|
||||
"title": "Brak danych o śnie",
|
||||
"description": "Gdy pojawią się dane o śnie (ręcznie lub przez Withings / Apple Health), wyświetli się tu rozkład faz na noc.",
|
||||
"cta": "Połącz Withings"
|
||||
}
|
||||
}
|
||||
},
|
||||
"thresholds": {
|
||||
"defaultLabel": "Default",
|
||||
@@ -2286,7 +2324,9 @@
|
||||
"title": "Danger Zone",
|
||||
"subtitle": "Destructive system-wide operations."
|
||||
}
|
||||
}
|
||||
},
|
||||
"carrier": "Operator",
|
||||
"carrierUnknown": "Nieznany operator"
|
||||
},
|
||||
"achievements": {
|
||||
"title": "Achievements",
|
||||
@@ -2596,7 +2636,20 @@
|
||||
"loadError": "Notification preferences could not be loaded.",
|
||||
"noChannels": "Configure a notification channel in Settings first.",
|
||||
"goToSettings": "Go to Settings",
|
||||
"channelDisabled": "Wyłączone"
|
||||
"channelDisabled": "Wyłączone",
|
||||
"admin": {
|
||||
"deployFailedTitle": "Wdrożenie nie powiodło się: {application}",
|
||||
"deployFailedBody": "Wystąpił błąd podczas wdrażania {application} (#{deployment}): {error}. Zobacz logi: {logsUrl}",
|
||||
"testNotificationTitle": "HealthLog powiadomienie testowe",
|
||||
"testNotificationBody": "To powiadomienie testowe zostało wywołane z panelu administracyjnego. Jeśli je widzisz, kanał działa.",
|
||||
"reminderCheckMissedTitle": "Pominięte przypomnienie: {medication}",
|
||||
"reminderCheckMissedBody": "{medication} ({dose}) nie zostało zarejestrowane w przedziale {window}.",
|
||||
"reminderCheckOverdueTitle": "Dawka opóźniona: {medication}",
|
||||
"reminderCheckOverdueBody": "{medication} ({dose}) w przedziale {window} jest opóźnione o {minutes} minut."
|
||||
},
|
||||
"user": {
|
||||
"telegramTestBody": "HealthLog: połączenie udane. Powiadomienia Telegram są aktywne."
|
||||
}
|
||||
},
|
||||
"i18n": {
|
||||
"maintainershipBanner": {
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* v1.4.27 B6 / BL-P4-8 — i18n drift-guard.
|
||||
*
|
||||
* Locks down the bundled key sets that ship across all six locales so
|
||||
* a future copy-paste regression can't silently drop a translation
|
||||
* row or introduce a per-locale-only key.
|
||||
*
|
||||
* The locale-integrity test (src/lib/__tests__/i18n-locale-integrity.test.ts)
|
||||
* already asserts EN/locale parity for every key. This file pins
|
||||
* specific call-site key groups so a contributor who only edits one
|
||||
* bundle gets a precise failure instead of a 200-line parity diff.
|
||||
*
|
||||
* Scope (mirrors v1.4.27 buckets B1, B3, B4, B5):
|
||||
* - dashboard.glp1.* (B1 — drug-level + weight tabs)
|
||||
* - admin.carrier* + admin.providerWithings + admin.providerPasskey (B3 — login carrier chip)
|
||||
* - insights.emptyState.* (B4 — per-metric empty states)
|
||||
* - notifications.admin.* (B5 — admin notification messages)
|
||||
* - notifications.user.* (B5 — user-facing Telegram test body)
|
||||
* - personalRecords + workouts (BL-P4-8 — PR + Workout strings)
|
||||
*/
|
||||
import { readFileSync, readdirSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const MESSAGES = join(__dirname, "../../messages");
|
||||
const LOCALES = readdirSync(MESSAGES)
|
||||
.filter((f) => f.endsWith(".json"))
|
||||
.map((f) => f.replace(/\.json$/, ""));
|
||||
|
||||
function loadBundle(locale: string): Record<string, unknown> {
|
||||
return JSON.parse(readFileSync(join(MESSAGES, `${locale}.json`), "utf8"));
|
||||
}
|
||||
|
||||
function flatten(
|
||||
obj: unknown,
|
||||
prefix: string,
|
||||
out: Map<string, string>,
|
||||
): void {
|
||||
if (obj == null || typeof obj !== "object") return;
|
||||
for (const [k, v] of Object.entries(obj as Record<string, unknown>)) {
|
||||
const key = prefix ? `${prefix}.${k}` : k;
|
||||
if (typeof v === "string") out.set(key, v);
|
||||
else if (typeof v === "object" && v !== null) flatten(v, key, out);
|
||||
}
|
||||
}
|
||||
|
||||
const FLAT_BY_LOCALE = new Map<string, Map<string, string>>();
|
||||
for (const locale of LOCALES) {
|
||||
const flat = new Map<string, string>();
|
||||
flatten(loadBundle(locale), "", flat);
|
||||
FLAT_BY_LOCALE.set(locale, flat);
|
||||
}
|
||||
|
||||
function keysForPrefix(prefix: string): Set<string> {
|
||||
// Source of truth: EN. The locale-integrity test ensures every
|
||||
// locale carries the same key shape, so EN's view is canonical.
|
||||
const enFlat = FLAT_BY_LOCALE.get("en");
|
||||
if (!enFlat) throw new Error("EN bundle did not load");
|
||||
const set = new Set<string>();
|
||||
for (const k of enFlat.keys()) {
|
||||
if (k === prefix || k.startsWith(`${prefix}.`)) set.add(k);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
const REQUIRED_KEY_SETS: Array<{
|
||||
label: string;
|
||||
required: string[];
|
||||
}> = [
|
||||
{
|
||||
label: "dashboard.glp1.* (B1 — GLP-1 tile tabs)",
|
||||
required: [
|
||||
"dashboard.glp1.title",
|
||||
"dashboard.glp1.tabLevel",
|
||||
"dashboard.glp1.tabWeight",
|
||||
"dashboard.glp1.tabsAria",
|
||||
"dashboard.glp1.rangeStripLabel",
|
||||
"dashboard.glp1.levelUnavailable",
|
||||
"dashboard.glp1.weightUnavailable",
|
||||
"dashboard.glp1.lastInjection",
|
||||
"dashboard.glp1.nextInjection",
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "admin.carrier (B3 — login carrier chip)",
|
||||
required: ["admin.carrier", "admin.carrierUnknown"],
|
||||
},
|
||||
{
|
||||
label: "insights.emptyState.* (B4 — per-metric empty states)",
|
||||
required: [
|
||||
"insights.emptyState.bloodPressure.title",
|
||||
"insights.emptyState.bloodPressure.description",
|
||||
"insights.emptyState.bloodPressure.cta",
|
||||
"insights.emptyState.weight.title",
|
||||
"insights.emptyState.weight.description",
|
||||
"insights.emptyState.weight.cta",
|
||||
"insights.emptyState.pulse.title",
|
||||
"insights.emptyState.pulse.description",
|
||||
"insights.emptyState.pulse.cta",
|
||||
"insights.emptyState.bmi.title",
|
||||
"insights.emptyState.bmi.description",
|
||||
"insights.emptyState.bmi.cta",
|
||||
"insights.emptyState.mood.title",
|
||||
"insights.emptyState.mood.description",
|
||||
"insights.emptyState.mood.cta",
|
||||
"insights.emptyState.medication.title",
|
||||
"insights.emptyState.medication.description",
|
||||
"insights.emptyState.medication.cta",
|
||||
"insights.emptyState.sleep.title",
|
||||
"insights.emptyState.sleep.description",
|
||||
"insights.emptyState.sleep.cta",
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "notifications.admin.* (B5 — admin notification dispatcher keys)",
|
||||
required: [
|
||||
"notifications.admin.deployFailedTitle",
|
||||
"notifications.admin.deployFailedBody",
|
||||
"notifications.admin.testNotificationTitle",
|
||||
"notifications.admin.testNotificationBody",
|
||||
"notifications.admin.reminderCheckMissedTitle",
|
||||
"notifications.admin.reminderCheckMissedBody",
|
||||
"notifications.admin.reminderCheckOverdueTitle",
|
||||
"notifications.admin.reminderCheckOverdueBody",
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "notifications.user.* (B5 — user-facing Telegram test body)",
|
||||
required: ["notifications.user.telegramTestBody"],
|
||||
},
|
||||
];
|
||||
|
||||
describe("v1.4.27 B6 i18n drift-guard — required keys present in every locale", () => {
|
||||
for (const { label, required } of REQUIRED_KEY_SETS) {
|
||||
describe(label, () => {
|
||||
it.each(LOCALES)(
|
||||
"messages/%s.json has every required key with a non-empty value",
|
||||
(locale) => {
|
||||
const flat = FLAT_BY_LOCALE.get(locale)!;
|
||||
const missing: string[] = [];
|
||||
const empty: string[] = [];
|
||||
for (const key of required) {
|
||||
const v = flat.get(key);
|
||||
if (v === undefined) missing.push(key);
|
||||
else if (v.trim() === "") empty.push(key);
|
||||
}
|
||||
expect(
|
||||
{ missing, empty },
|
||||
`Locale ${locale} drifted from the ${label} key set.`,
|
||||
).toEqual({ missing: [], empty: [] });
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe("v1.4.27 B6 i18n drift-guard — PR + Workout strings stay in lockstep", () => {
|
||||
// BL-P4-8: PR and Workout strings were the trigger for the
|
||||
// drift-guard ask. Personal-record badge / tooltip live under
|
||||
// `insights.personalRecord.*`. Workout strings are not yet in the
|
||||
// bundles — the v1.4.23 batch ingest landed the API, the UI
|
||||
// surface ships in v1.4.28 / v1.5. The drift-guard keeps the
|
||||
// namespace anchor live so the workout copy work in v1.4.28 lands
|
||||
// with parity from the first commit.
|
||||
const prKeys = [...keysForPrefix("insights.personalRecord")];
|
||||
|
||||
it("insights.personalRecord namespace has at least one key (sanity)", () => {
|
||||
expect(
|
||||
prKeys.length,
|
||||
"insights.personalRecord.* keys exist in en.json",
|
||||
).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it.each(LOCALES)(
|
||||
"messages/%s.json carries every insights.personalRecord.* key with a non-empty value",
|
||||
(locale) => {
|
||||
const flat = FLAT_BY_LOCALE.get(locale)!;
|
||||
const missing: string[] = [];
|
||||
const empty: string[] = [];
|
||||
for (const key of prKeys) {
|
||||
const v = flat.get(key);
|
||||
if (v === undefined) missing.push(key);
|
||||
else if (v.trim() === "") empty.push(key);
|
||||
}
|
||||
expect(
|
||||
{ missing, empty },
|
||||
`Locale ${locale} drifted from the personal-record key set.`,
|
||||
).toEqual({ missing: [], empty: [] });
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -38,6 +38,7 @@ import { useChartOverlayPrefs } from "@/hooks/use-chart-overlay-prefs";
|
||||
import { useViewportWidth } from "@/hooks/use-viewport-width";
|
||||
import { chooseTickInterval } from "@/lib/charts/x-axis-density";
|
||||
import { CHART_HEIGHT_PX } from "@/lib/charts/constants";
|
||||
import { moodLabelKeyForScore } from "@/lib/mood/labels";
|
||||
|
||||
// --- Types ---
|
||||
|
||||
@@ -484,12 +485,16 @@ export function MoodChart({
|
||||
|
||||
const maxPointIndex = Math.max(0, (chartData?.length ?? 1) - 1);
|
||||
|
||||
// v1.4.27 B6 / BL-P6-11 — the chart axis and the mood-list cards
|
||||
// share `MOOD_LABEL_KEYS` so a polishing-pass copy update lands in
|
||||
// both surfaces. The shared resolver maps a numeric score back to
|
||||
// the canonical key set under `mood.level*`.
|
||||
const moodLabels: Record<number, string> = {
|
||||
1: t("charts.moodLabel1"),
|
||||
2: t("charts.moodLabel2"),
|
||||
3: t("charts.moodLabel3"),
|
||||
4: t("charts.moodLabel4"),
|
||||
5: t("charts.moodLabel5"),
|
||||
1: t(moodLabelKeyForScore(1) ?? "mood.levelLausig"),
|
||||
2: t(moodLabelKeyForScore(2) ?? "mood.levelSchlecht"),
|
||||
3: t(moodLabelKeyForScore(3) ?? "mood.levelOkay"),
|
||||
4: t(moodLabelKeyForScore(4) ?? "mood.levelGut"),
|
||||
5: t(moodLabelKeyForScore(5) ?? "mood.levelSuperGut"),
|
||||
};
|
||||
|
||||
// v1.4.18 — emoji glyph map removed. the maintainer explicitly rejected
|
||||
@@ -623,7 +628,7 @@ export function MoodChart({
|
||||
</div>
|
||||
) : chartData.length < 3 ? (
|
||||
// v1.4.16 B1a — sparse-data placeholder consistent with the
|
||||
// BP/weight/pulse charts. Height tracks the chart strip motion-reduce:animate-none's
|
||||
// BP/weight/pulse charts. Height tracks the chart strip's
|
||||
// shared CHART_HEIGHT_PX so the empty state preserves the
|
||||
// trend-row rhythm (v1.4.27 — was 280, now 240 to match every
|
||||
// other dashboard chart card).
|
||||
|
||||
@@ -62,23 +62,16 @@ import {
|
||||
import { useState } from "react";
|
||||
import { formatDateTime } from "@/lib/format";
|
||||
import { useTranslations, useFormatters } from "@/lib/i18n/context";
|
||||
import {
|
||||
MOOD_LABEL_KEYS,
|
||||
MOOD_SCORE_BY_ENUM,
|
||||
} from "@/lib/mood/labels";
|
||||
import { invalidateKeys, moodDependentKeys } from "@/lib/query-keys";
|
||||
|
||||
const MOOD_SCORES: Record<string, number> = {
|
||||
SUPER_GUT: 5,
|
||||
GUT: 4,
|
||||
OKAY: 3,
|
||||
SCHLECHT: 2,
|
||||
LAUSIG: 1,
|
||||
};
|
||||
|
||||
const MOOD_LABEL_KEYS: Record<string, string> = {
|
||||
SUPER_GUT: "mood.levelSuperGut",
|
||||
GUT: "mood.levelGut",
|
||||
OKAY: "mood.levelOkay",
|
||||
SCHLECHT: "mood.levelSchlecht",
|
||||
LAUSIG: "mood.levelLausig",
|
||||
};
|
||||
// Re-export the score map under the legacy local name to keep the
|
||||
// rest of this file unchanged. v1.4.27 B6 / BL-P6-11 — the single
|
||||
// source of truth now lives in `@/lib/mood/labels`.
|
||||
const MOOD_SCORES = MOOD_SCORE_BY_ENUM as Record<string, number>;
|
||||
|
||||
interface MoodEntry {
|
||||
id: string;
|
||||
@@ -429,7 +422,7 @@ export function MoodList({ onAddFirst }: MoodListProps = {}) {
|
||||
{/* Mobile list — v1.4.15 phase-A3 fix #2: previously the row
|
||||
rendered the score TWICE on mobile (the big number in the
|
||||
left badge AND a duplicate in the title line: "2 (schlecht)").
|
||||
Desktop motion-reduce:animate-none's table version only ever showed one. The badge is
|
||||
Desktop's table version only ever showed one. The badge is
|
||||
the visual anchor; next to it the user wants the textual
|
||||
label, not a second copy of the digit. The
|
||||
`data-testid="mood-row"` hook is what the Playwright Pixel-5
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* v1.4.27 B6 / BL-P6-11 — single source of truth for mood verbal labels.
|
||||
*
|
||||
* Previously `mood-list.tsx` and `charts/mood-chart.tsx` each carried
|
||||
* their own label set:
|
||||
* - List used `mood.levelSuperGut` / `levelGut` / `levelOkay` /
|
||||
* `levelSchlecht` / `levelLausig` (rendering "Amazing / Good /
|
||||
* Okay / Bad / Terrible").
|
||||
* - Chart used `charts.moodLabel1..5` (rendering "Awful / Bad /
|
||||
* Okay / Good / Great").
|
||||
*
|
||||
* Two distinct copy sets for the same five mood states drifted twice
|
||||
* during v1.4.18 / v1.4.25 polishing passes. Pinning both call-sites
|
||||
* to the same key map keeps the chart axis and the list copy in
|
||||
* lockstep.
|
||||
*/
|
||||
|
||||
export const MOOD_ENUM_VALUES = [
|
||||
"LAUSIG",
|
||||
"SCHLECHT",
|
||||
"OKAY",
|
||||
"GUT",
|
||||
"SUPER_GUT",
|
||||
] as const;
|
||||
|
||||
export type MoodEnum = (typeof MOOD_ENUM_VALUES)[number];
|
||||
|
||||
/** Mood enum → numeric score (1..5). Mirrors `getScoreForMood()`. */
|
||||
export const MOOD_SCORE_BY_ENUM: Record<MoodEnum, number> = {
|
||||
LAUSIG: 1,
|
||||
SCHLECHT: 2,
|
||||
OKAY: 3,
|
||||
GUT: 4,
|
||||
SUPER_GUT: 5,
|
||||
};
|
||||
|
||||
/** Numeric score (1..5) → mood enum. Inverse of `MOOD_SCORE_BY_ENUM`. */
|
||||
export const MOOD_ENUM_BY_SCORE: Record<number, MoodEnum> = {
|
||||
1: "LAUSIG",
|
||||
2: "SCHLECHT",
|
||||
3: "OKAY",
|
||||
4: "GUT",
|
||||
5: "SUPER_GUT",
|
||||
};
|
||||
|
||||
/**
|
||||
* Mood enum → i18n key for the verbal label.
|
||||
*
|
||||
* Both `components/mood/mood-list.tsx` and
|
||||
* `components/charts/mood-chart.tsx` import from this map. Adding a
|
||||
* new mood state means updating the enum + key map here once. The
|
||||
* indexer is `string` rather than `MoodEnum` because list rows arrive
|
||||
* from the API typed as `string` — the validation layer already
|
||||
* checked the enum bound via Zod, and a missing key returns
|
||||
* `undefined` rather than ever rendering a wrong label.
|
||||
*/
|
||||
export const MOOD_LABEL_KEYS: Record<string, string> = {
|
||||
SUPER_GUT: "mood.levelSuperGut",
|
||||
GUT: "mood.levelGut",
|
||||
OKAY: "mood.levelOkay",
|
||||
SCHLECHT: "mood.levelSchlecht",
|
||||
LAUSIG: "mood.levelLausig",
|
||||
};
|
||||
|
||||
/** Numeric score (1..5) → i18n key for the verbal label. */
|
||||
export function moodLabelKeyForScore(score: number): string | undefined {
|
||||
const moodEnum = MOOD_ENUM_BY_SCORE[score];
|
||||
if (!moodEnum) return undefined;
|
||||
return MOOD_LABEL_KEYS[moodEnum];
|
||||
}
|
||||
Reference in new issue
Block a user