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.

This commit is contained in:
Torsten Schulz (local)
2026-02-09 15:12:23 +01:00
parent c8d8254fc1
commit b51d396afc
3 changed files with 18 additions and 3 deletions

View File

@@ -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;