I have a simple language switch, copied from here. When im on the homepage and switch from german to english, english is not shown anymore. The homepage is translated and the file has all needed permissions.
The strangest thing: I have two switches for the language (I know its bad, but the design is made like that) and the second language switch works (meaning even when english is selected, it gets marked as “active” and is still showing up).
However there is no difference between them as they use the same snippet and when I remove the first language switch so there is just one, this one will also remove the english li element when i switch to english. PS: No Dom manipulation is happening, so i guess it’s a problem within php.
Here is my language switch snippet:
<nav class="languages hide--<?= $view ?>" id="languages"> <ul> <?php foreach($kirby->languages() as $language): ?> <li class="<?php e($kirby->language() == $language, 'active') ?>"> <a href="<?= $page->url($language->code()) ?>"><?= html($language->name()) ?></a> </li> <?php endforeach ?> </ul> </nav>