(Manually) setting the language

Well, manually is maybe not the right word but here’s what I’m trying to do:

I have users with the guest role and every user has a language saved alongside the other information like username and password. But I don’t know how I can tell kirby to pick the language based on this saved information (as soon as a user is logged in of course).

I know about auto detection but it’s nowhere to be found in the documentation how it decides on the appropriate language: Does it check the browsers/system language or the location based on IP-Adress or both or is there other data that is being used as well and what has priority?
And why should I rely on auto detection if I got the language saved and could decide on the language with absolute certainty?

I know how to read the users set language but I have no clue on how to tell kirby to display that languages content.

Thanks for any help


I just realised how I could probably do it.

I just have to adjust the login controller and send the users to the proper URL
…and once they’re there they stay there.

$language = $site->user()->language();
if($language == 'de') { $language = ''; }
go('/' . $language);

German is the main language and doesn’t use the language code in the URL.

Now I need to see if I can still use the auto-detection for the pages where the users aren’t logged in yet. (In my current project, users that aren’t logged in will only see the login page.)