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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user