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