Multilang stop redirect to default language

Dear forum,

I am running a multilanguage site and do have the following problem:

When setting a default language, kirby always redirects to this lang (in my case ‘en’). So if you open domain.tld/ it will redirect to domain.tld/en
But I want to implement a basic lang-detection using PHP. Which works basically. The language is detected correctly. What I want to do is, check if the URL contains one of the supported language (en/de). If it doesn’t I want to redirect to the detected language. Currently I am doing this in my template as the very first thing.

Now here’s the problem: Kirby redirects before I can do. It will redirect to /defaultLang/… even before I can take action in my template. I also tried the same thing using a route, but this route will also take action AFTER the defaultLang redirect.

So is there an option to disable that defaultLang redirect or a place where I should do my lang-detect so it runs before kirbys lang-redirect?

I also tried the language.detect option, but it seems like it doesn’t work as expected (which maybe documented here: https://github.com/getkirby/kirby/issues/268). So I deactivated it again.

Maybe you have any ideas? Thank you!

I think it makes most sense to fix the issue with Kirby’s language detection. I’m looking into the issue now.

Sounds good, thank you!