feat(localization): expand language support and enhance UI for user settings
All checks were successful
Deploy to production / deploy (push) Successful in 3m0s

- Added support for additional UI locales including Cebuano and Spanish, improving accessibility for a broader user base.
- Updated language selection components in the AppHeader and SettingsWidget to reflect new language options, enhancing user experience.
- Enhanced localization of various UI elements across components, ensuring consistent language representation and improved user engagement.
- Implemented logic to synchronize user language preferences with backend settings, providing a seamless experience when changing languages.
This commit is contained in:
Torsten Schulz (local)
2026-04-02 07:54:44 +02:00
parent ac5d436a36
commit 6d9d69dc10
72 changed files with 1792 additions and 343 deletions

View File

@@ -30,6 +30,8 @@ function clearAuthStorage() {
});
}
const SUPPORTED_UI_LOCALES = ['de', 'en', 'ceb', 'es'];
function persistAuthStorage(user, rememberMe) {
const targetStorage = rememberMe ? localStorage : sessionStorage;
clearAuthStorage();
@@ -38,6 +40,15 @@ function persistAuthStorage(user, rememberMe) {
targetStorage.setItem('userid', user?.id || '');
}
function readPersistedUiLanguage() {
try {
const saved = localStorage.getItem('uiLanguage');
return saved && SUPPORTED_UI_LOCALES.includes(saved) ? saved : null;
} catch (_) {
return null;
}
}
const store = createStore({
state: {
isLoggedIn: getStoredValue('isLoggedIn') === 'true',
@@ -52,7 +63,10 @@ const store = createStore({
backendConnecting: false,
daemonConnecting: false,
language: (() => {
// Verwende die gleiche Logik wie in main.js
const persisted = readPersistedUiLanguage();
if (persisted) {
return persisted;
}
const browserLanguage = navigator.language || navigator.languages[0];
if (browserLanguage.startsWith('ceb') || browserLanguage.startsWith('bis')) {
@@ -99,6 +113,15 @@ const store = createStore({
state.user = user;
persistAuthStorage(user, rememberMe);
state.menuNeedsUpdate = true;
const langParam = user.param?.find((p) => p.name === 'language');
if (langParam?.value && SUPPORTED_UI_LOCALES.includes(langParam.value)) {
state.language = langParam.value;
try {
localStorage.setItem('uiLanguage', langParam.value);
} catch (_) {
/* ignore */
}
}
if (user.param.filter(param => ['birthdate', 'gender'].includes(param.name)).length < 2) {
router.push({ path: '/settings/personal' });
}
@@ -110,6 +133,11 @@ const store = createStore({
localStorage.removeItem('menu');
state.menuNeedsUpdate = false;
try {
localStorage.removeItem('uiLanguage');
} catch (_) {
/* ignore */
}
// Setze die Sprache auf die Browser-Sprache zurück
const browserLanguage = navigator.language || navigator.languages[0];
@@ -150,6 +178,11 @@ const store = createStore({
},
setLanguage(state, language) {
state.language = language;
try {
localStorage.setItem('uiLanguage', language);
} catch (_) {
/* ignore */
}
},
setMenu(state, menu) {
state.menu = menu;