Add localization for marriage gift, lover maintenance, and household order: Update German, English, and Spanish translation files to include new terms related to marriage and household management. Enhance MoneyHistoryView to improve activity translation handling with additional candidate formats.

This commit is contained in:
Torsten Schulz (local)
2026-03-23 12:09:31 +01:00
parent 42e894d4e4
commit 22f1803e7d
4 changed files with 40 additions and 11 deletions

View File

@@ -753,7 +753,12 @@
"build_vehicles": "Transportmittel gebaut", "build_vehicles": "Transportmittel gebaut",
"transport": "Transport", "transport": "Transport",
"Marriage cost": "Heiratskosten", "Marriage cost": "Heiratskosten",
"marriage_gift": "Geschenk an Ehepartner",
"Gift cost": "Geschenk-Kosten", "Gift cost": "Geschenk-Kosten",
"lover maintenance": "Unterhalt für Liebschaft",
"servants_monthly": "Dienerschaft bezahlt",
"servants_hired": "Diener eingestellt",
"household_order": "Haus geordnet",
"housebuy": "Hauskauf", "housebuy": "Hauskauf",
"Baptism": "Taufe", "Baptism": "Taufe",
"credit taken": "Kredit aufgenommen", "credit taken": "Kredit aufgenommen",

View File

@@ -171,7 +171,12 @@
"build_vehicles": "Transport vehicles built", "build_vehicles": "Transport vehicles built",
"transport": "Transport", "transport": "Transport",
"Marriage cost": "Marriage cost", "Marriage cost": "Marriage cost",
"marriage_gift": "Gift for spouse",
"Gift cost": "Gift cost", "Gift cost": "Gift cost",
"lover maintenance": "Lover maintenance",
"servants_monthly": "Servants paid",
"servants_hired": "Servants hired",
"household_order": "Household ordered",
"housebuy": "House purchase", "housebuy": "House purchase",
"Baptism": "Baptism", "Baptism": "Baptism",
"credit taken": "Credit taken", "credit taken": "Credit taken",

View File

@@ -720,7 +720,12 @@
"build_vehicles": "Medios de transporte construidos", "build_vehicles": "Medios de transporte construidos",
"transport": "Transporte", "transport": "Transporte",
"Marriage cost": "Costes de matrimonio", "Marriage cost": "Costes de matrimonio",
"marriage_gift": "Regalo para el cónyuge",
"Gift cost": "Coste de regalo", "Gift cost": "Coste de regalo",
"lover maintenance": "Manutención de amante",
"servants_monthly": "Pago de servidumbre",
"servants_hired": "Contratación de sirvientes",
"household_order": "Orden del hogar",
"housebuy": "Compra de casa", "housebuy": "Compra de casa",
"Baptism": "Bautizo", "Baptism": "Bautizo",
"credit taken": "Crédito solicitado", "credit taken": "Crédito solicitado",

View File

@@ -95,17 +95,31 @@ export default {
} }
}, },
translateActivity(activity) { translateActivity(activity) {
// Handle nested keys like "health.pill" -> "health.pill" const candidates = [activity];
const key = `falukant.moneyHistory.activities.${activity}`;
const translation = this.$t(key); if (typeof activity === 'string') {
// If translation is the same as key, try nested structure candidates.push(activity.replaceAll('_', ' '));
if (translation === key && activity.includes('.')) { candidates.push(activity.replaceAll(' ', '_'));
const parts = activity.split('.');
const nestedKey = `falukant.moneyHistory.activities.${parts[0]}.${parts[1]}`;
const nestedTranslation = this.$t(nestedKey);
return nestedTranslation !== nestedKey ? nestedTranslation : activity;
} }
return translation !== key ? translation : activity;
for (const candidate of candidates) {
const key = `falukant.moneyHistory.activities.${candidate}`;
const translation = this.$t(key);
if (translation !== key) {
return translation;
}
if (candidate.includes('.')) {
const parts = candidate.split('.');
const nestedKey = `falukant.moneyHistory.activities.${parts[0]}.${parts[1]}`;
const nestedTranslation = this.$t(nestedKey);
if (nestedTranslation !== nestedKey) {
return nestedTranslation;
}
}
}
return activity;
}, },
openGraphDialog() { openGraphDialog() {
this.$refs.graphDialog.open(); this.$refs.graphDialog.open();
@@ -150,4 +164,4 @@ h2 {
overflow: auto; overflow: auto;
height: 100%; height: 100%;
} }
</style> </style>