I have a route in config that tries to get the active language for the user, this is the relevant part of my code:
[
'pattern' => '(:any)/myroute',
'method' => 'POST',
'action' => function () {
return kirby()->language()->code();
}
[
…but it seems no matter what language is active for the user, this always returns the default language, in this case “en”
I know the active lang is different from the returned lang, because I use <?php dump($kirby->language()) ?>
in my template code and compare with returned language.
What am I doing wrong ?
Should I pass the active lang from the template to the route ? Is there any way to get active lang directly in config ?
Thanks