Hey there.
I’m currently setting up multilanguage support for a site and I’am having a little problem on the homepage: when I’ve enabled the auto language detection I’am not able to switch the language anymore.
I’ve set up everything just the normal way as suggested in the kirby docs here: https://getkirby.com/docs/languages/setup
On all subpages everything works fine and I’m able to switch the language with:
<nav class="languages" role="navigation">
<ul>
<?php foreach($site->languages() as $language): ?>
<li<?php e($site->language() == $language, ' class="active"') ?>>
<a href="<?php echo $page->url($language->code()) ?>">
<?php echo html($language->name()) ?>
</a>
</li>
<?php endforeach ?>
</ul>
</nav>
But on the homepage I’am stuck with the German version, if German is set as the preferred language in the browser. If I click on the link for the English version it just reloads the German version.
I can fix it with changing 'url' => '/',
to 'url' => '/en',
– but I don’t really want the language string in all urls for the primary language, if I can avoid it.
I guess most users won’t switch from German to English if their browser is set to prefer German, but it kinda bugs me to have link to a english version that simply does nothing on the main page.
Any ideas?