aside anapssungen
This commit is contained in:
@@ -42,7 +42,15 @@ $publicTarget = ltrim($publicTarget, '/');
|
||||
<?php foreach ($locales as $locale): ?>
|
||||
<?php
|
||||
$isActive = $locale === I18n::$locale;
|
||||
$label = strtoupper((string) $locale);
|
||||
$normalizedLocale = strtolower(trim((string) $locale));
|
||||
if (strpos($normalizedLocale, '-') !== false) {
|
||||
$normalizedLocale = explode('-', $normalizedLocale, 2)[0];
|
||||
}
|
||||
$languageLabels = [
|
||||
'de' => t('German'),
|
||||
'en' => t('English'),
|
||||
];
|
||||
$label = $languageLabels[$normalizedLocale] ?? strtoupper((string) $locale);
|
||||
$publicUrl = $base . '/' . $locale . ($publicTarget !== '' ? '/' . $publicTarget : '');
|
||||
$switchUrl = $isLoggedIn
|
||||
? ($baseUrl . '?locale=' . $locale . '&return=' . urlencode($returnTarget))
|
||||
@@ -52,7 +60,7 @@ $publicTarget = ltrim($publicTarget, '/');
|
||||
<a href="<?php e($switchUrl); ?>"
|
||||
class="<?php e($isActive ? 'active' : ''); ?>"
|
||||
<?php if ($isActive) { ?>aria-current="true"<?php } ?>>
|
||||
<?php e(t('Language')); ?>: <?php e($label); ?>
|
||||
<?php e($label); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Reference in New Issue
Block a user