refactor(i18n): improve language handling and UI updates
All checks were successful
Deploy to production / deploy (push) Successful in 2m49s

- Enhanced language setting logic in App.vue and AppHeader.vue to support reactive updates without page reloads.
- Updated language options in AppHeader.vue to use native labels for improved clarity.
- Introduced a utility function in i18n/index.js to streamline locale updates, ensuring consistent language handling across the application.
This commit is contained in:
Torsten Schulz (local)
2026-04-07 15:52:16 +02:00
parent c5b8860605
commit ae635b9c16
3 changed files with 38 additions and 8 deletions

View File

@@ -195,11 +195,20 @@ const i18n = createI18n({
messages
});
// Überwache Änderungen der Sprache im Store und aktualisiere i18n entsprechend
function setGlobalLocale(next) {
const loc = i18n.global.locale;
if (loc && typeof loc === 'object' && 'value' in loc) {
loc.value = next;
} else {
i18n.global.locale = next;
}
}
// Überwache Änderungen der Sprache im Store und aktualisiere i18n (ohne Seiten-Reload)
store.watch(
(state) => state.language,
(newLanguage) => {
i18n.global.locale.value = newLanguage;
setGlobalLocale(newLanguage);
}
);