up
This commit is contained in:
@@ -2,14 +2,17 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const supportedLangs = ['de', 'en', 'it', 'fr'];
|
||||
|
||||
// Globale Config aus PHP-Partial (app_config.php)
|
||||
const cfg = window.usbConfig || {};
|
||||
const cfgLang = (cfg.lang || '').toLowerCase();
|
||||
|
||||
function resolveCurrentLang() {
|
||||
const url = new URL(window.location.href);
|
||||
const urlLang = (url.searchParams.get('lang') || '').toLowerCase();
|
||||
const docLang = (document.documentElement.getAttribute('lang') || '').toLowerCase();
|
||||
const globalLang = (window.currentLang || '').toLowerCase();
|
||||
const url = new URL(window.location.href);
|
||||
const urlLang = (url.searchParams.get('lang') || '').toLowerCase();
|
||||
const docLang = (document.documentElement.getAttribute('lang') || '').toLowerCase();
|
||||
|
||||
if (supportedLangs.includes(urlLang)) return urlLang;
|
||||
if (supportedLangs.includes(globalLang)) return globalLang;
|
||||
if (supportedLangs.includes(cfgLang)) return cfgLang;
|
||||
if (supportedLangs.includes(docLang)) return docLang;
|
||||
return 'de';
|
||||
}
|
||||
@@ -27,7 +30,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
const currentQuery = window.location.search || '';
|
||||
const redirect = currentPath + currentQuery;
|
||||
|
||||
// Sprache aus URL / globalem State ableiten
|
||||
const lang = resolveCurrentLang();
|
||||
|
||||
// Wenn wir bereits auf /login sind → nur zum #auth scrollen
|
||||
|
||||
Reference in New Issue
Block a user