From b51d396afcc3cb42c57137dbde4ba98e4b9ed048 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 9 Feb 2026 15:12:23 +0100 Subject: [PATCH] Enhance FalukantWidget gender label logic and add age-based labels: Updated gender label computation to include age-based distinctions for children and adults. Added new translation key for "years" in both German and English locale files. --- .../src/components/widgets/FalukantWidget.vue | 15 ++++++++++++--- frontend/src/i18n/locales/de/falukant.json | 1 + frontend/src/i18n/locales/en/falukant.json | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/widgets/FalukantWidget.vue b/frontend/src/components/widgets/FalukantWidget.vue index 1ecb4c6..d4449aa 100644 --- a/frontend/src/components/widgets/FalukantWidget.vue +++ b/frontend/src/components/widgets/FalukantWidget.vue @@ -44,9 +44,18 @@ export default { falukantGenderLabel() { const g = this.falukantData?.gender; if (g == null || g === '') return '—'; - const key = `falukant.create.${g}`; - const t = this.$t(key); - return t === key ? this.$t(`general.gender.${g}`) || g : t; + + // Altersabhängige Bezeichnung (sprachlich natürlicher im Widget) + // Default: unter 18 = Junge/Mädchen, sonst Mann/Frau + const age = Number(this.falukantData?.age); + const isChild = !Number.isNaN(age) && age < 18; + if (g === 'female') return isChild ? 'Mädchen' : 'Frau'; + if (g === 'male') return isChild ? 'Junge' : 'Mann'; + + // Fallback auf vorhandene Übersetzungen + const key = `falukant.create.${g}`; + const t = this.$t(key); + return t === key ? this.$t(`general.gender.${g}`) || g : t; }, falukantAgeLabel() { const ageValue = this.falukantData?.age; diff --git a/frontend/src/i18n/locales/de/falukant.json b/frontend/src/i18n/locales/de/falukant.json index 5297645..878fe5e 100644 --- a/frontend/src/i18n/locales/de/falukant.json +++ b/frontend/src/i18n/locales/de/falukant.json @@ -119,6 +119,7 @@ "name": "Name", "money": "Vermögen", "age": "Alter", + "years": "Jahre", "mainbranch": "Heimatstadt", "nobleTitle": "Stand" }, diff --git a/frontend/src/i18n/locales/en/falukant.json b/frontend/src/i18n/locales/en/falukant.json index 939151f..474893b 100644 --- a/frontend/src/i18n/locales/en/falukant.json +++ b/frontend/src/i18n/locales/en/falukant.json @@ -93,6 +93,11 @@ "children": "Children", "children_unbaptised": "Unbaptised children" }, + "overview": { + "metadata": { + "years": "years" + } + }, "health": { "amazing": "Amazing", "good": "Good",