Problem with language switch

Hi everyone,

i encountered a strange problem with my multi-language (de/en/fr) site, specifically the language switch. Everything is working fine until i reach the third level of the page tree (home/xyz/problem).
The language switch displays all languages, if the default language is active. If another language is active, only the switch to the default language is shown.

I nailed it down to <?= $page->url($language->code()) ?> but am unable to come up with a solution.

Thanks in advance for some help!

Here’s the complete code for the language switch:

<ul class="navbar navbar-nav justify-content-center">
  <li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle" href="#" id="Dropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?= strtoupper($kirby->language()) ?></a>
    <div class="dropdown-menu rounded-0" aria-labelledby="Dropdown">
      <?php foreach($kirby->languages() as $language): ?>
        <?php if ($language != $kirby->language()) { ?>
   	      <a class="dropdown-item" href=""><?= html($language->name()) ?></a>
      <?php endforeach ?>

Maybe this one is related: It will be fixed in 3.1.4 and is already on the develop branch (if you want to test if that fixes your issues as well).

Thanks - that’s it!

As descibed by RastaTux, this occurs only, if the switch is moved before the navigation loop.