For example you can use following routes:
return [
'debug' => true,
'languages' => true,
'languages.detect' => true,
'routes' => [
[
'pattern' => '/',
'action' => function () {
$session = kirby()->session();
if ($session->get('languages.detect', false) === false && option('languages.detect') === true) {
$session->set('languages.detect', true);
return kirby()
->response()
->redirect(kirby()->detectedLanguage()->url());
}
return page();
}
]
]
];