Reference

Guide

user.changeLanguage:before

$user, $language

Example

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