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 c45ca3cb67
commit aae84922b8
4 changed files with 40 additions and 11 deletions

View File

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