header language
This commit is contained in:
@@ -46,36 +46,28 @@ if ($isLoggedIn) {
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
// Dynamische Sprachliste
|
||||
// kommt aus app_config.php:
|
||||
//
|
||||
// $usbConfig['i18n']['available'] = [
|
||||
// 'de' => ['code'=>'de','label'=>'Deutsch','flag'=>'🇩🇪'],
|
||||
// ...
|
||||
// ];
|
||||
// $usbConfig['i18n']['current'] = 'de';
|
||||
// Sprachkontext direkt aus fileload.php
|
||||
// -----------------------------------------
|
||||
|
||||
// aktuelle Sprache aus globalem Kontext
|
||||
$currentLang = $usbConfig['i18n']['current'] ?? ($lang ?? 'en');
|
||||
// Aktuelle Sprache und verfügbare Sprachen aus den GLOBALS
|
||||
$currentLang = $GLOBALS['lang'] ?? 'en';
|
||||
$availableLangs = $GLOBALS['availableLangs'] ?? [];
|
||||
|
||||
// verfügbare Sprachen aus Config
|
||||
$availableLangs = $usbConfig['i18n']['available'] ?? [];
|
||||
|
||||
// Fallback: Wenn Config noch nichts liefert, nimm nur die aktuelle Sprache
|
||||
if (!$availableLangs || !is_array($availableLangs)) {
|
||||
// Sicherheits-Fallback: falls aus irgendeinem Grund leer
|
||||
if (!is_array($availableLangs) || empty($availableLangs)) {
|
||||
$availableLangs = [
|
||||
$currentLang => [
|
||||
'code' => $currentLang,
|
||||
'label' => strtoupper($currentLang),
|
||||
'flag' => '🏳️'
|
||||
]
|
||||
'flag' => '🏳️',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// Sicherstellen, dass currentLang in der Liste ist
|
||||
// Sicherstellen, dass currentLang eine gültige Sprache ist
|
||||
if (!isset($availableLangs[$currentLang])) {
|
||||
$currentLang = array_key_first($availableLangs);
|
||||
$keys = array_keys($availableLangs);
|
||||
$currentLang = $keys[0] ?? 'en';
|
||||
}
|
||||
|
||||
// aktuelle Sprache-Info
|
||||
@@ -83,6 +75,7 @@ $currentLangInfo = $availableLangs[$currentLang] ?? ['code' => $currentLang];
|
||||
$currentLangFlag = $currentLangInfo['flag'] ?? '🏳️';
|
||||
$currentLangCode = strtoupper($currentLangInfo['code'] ?? $currentLang);
|
||||
$currentLangLabel = $currentLangInfo['label'] ?? $currentLangCode;
|
||||
|
||||
?>
|
||||
<header class="sticky top-0 z-40 border-b border-brand-border/70 backdrop-blur bg-brand-bg/85">
|
||||
<div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8 flex items-center justify-between h-16">
|
||||
|
||||
Reference in New Issue
Block a user