user.changeLanguage:before $user, $language /site/config/config.php return [ 'hooks' => [ 'user.changeLanguage:before' => function ($user, $language) { // your code goes here } ] ]