New functions for the language library

This commit is contained in:
Michael 2023-09-03 17:44:44 +00:00
parent 64c8c2afdf
commit 595508a91f
4 changed files with 41 additions and 14 deletions

View file

@ -536,14 +536,13 @@ class User
/**
* Fetch the language code from the given user. If the code is invalid, return the system language
*
* @param integer $uid User-Id
* @param boolean $short If true, return the short form g.g. "en", otherwise the long form e.g. "en-gb"
* @param integer $uid User-Id
* @return string
*/
public static function getLanguageCode(int $uid, bool $short): string
public static function getLanguageCode(int $uid): string
{
$owner = self::getOwnerDataById($uid);
$languages = DI::l10n()->getAvailableLanguages($short);
$languages = DI::l10n()->getAvailableLanguages(true);
if (in_array($owner['language'], array_keys($languages))) {
$language = $owner['language'];
} else {