User's default language

Permalink
How to get user's default language set in the user profile, backend set in Users table uDefaultLanguage field?

Localization::activeLanguage(); does not bring me that user's default language.

Janks
 
Janks replied on at Permalink Reply
Janks
I made my own function as there is no such in the core code:
function GetUserLocale($UserID) {
    $db = Loader::db();
    $UserLocale = $db->GetOne("SELECT IFNULL(U.uDefaultLanguage, 'None') FROM Users U WHERE U.uID=".$UserID);
    return $UserLocale;
}
mlocati replied on at Permalink Reply
mlocati
There's a way to get the user preferred language:

$u = new \Concrete\Core\User\User();
$userPreferredLanguage = $u->getUserDefaultLanguage();