This commit is contained in:
2025-11-26 21:59:49 +01:00
parent 1cf4553163
commit a6bd3361fb
6 changed files with 15 additions and 19 deletions

View File

@@ -77,7 +77,7 @@ $currentLangLabel = $currentLangInfo['label'] ?? $currentLangCode;
// -----------------------------------------
// Helper: URL mit anderem ?lang=.. bauen
// -----------------------------------------
$currentPath = strtok($_SERVER['REQUEST_URI'] ?? '/', '?');
$currentPath = strtok($_SERVER['REQUEST_URI'] ?? '/', '?');
$currentQuery = $_GET ?? [];
function build_lang_url(string $code, string $path, array $query): string
@@ -137,13 +137,17 @@ function build_lang_url(string $code, string $path, array $query): string
class="hidden absolute right-0 mt-2 w-32 rounded-xl bg-brand-surface border border-brand-border shadow-lg py-1 text-xs z-40">
<?php foreach ($availableLangs as $code => $info): ?>
<?php
$isActive = ($code === $currentLang);
// 👉 aktuelle Sprache NICHT noch einmal im Menü anzeigen
if ($code === $currentLang) {
continue;
}
$flag = $info['flag'] ?? '🏳️';
$label = strtoupper($info['code'] ?? $code);
$url = build_lang_url($code, $currentPath, $currentQuery);
?>
<a href="<?= htmlspecialchars($url) ?>"
class="lang-pill flex items-center gap-2 w-full text-left px-3 py-1.5 uppercase tracking-[0.18em] text-brand-muted hover:text-brand-primary hover:bg-brand-bg/60 <?= $isActive ? 'bg-brand-bg/60' : '' ?>">
class="lang-pill flex items-center gap-2 w-full text-left px-3 py-1.5 uppercase tracking-[0.18em] text-brand-muted hover:text-brand-primary hover:bg-brand-bg/60">
<span class="text-base"><?= htmlspecialchars($flag) ?></span>
<span><?= htmlspecialchars($label) ?></span>
</a>