mirror of
https://github.com/friendica/friendica
synced 2025-04-22 08:30:10 +00:00
New function to change language codes for the library
This commit is contained in:
parent
7220027332
commit
c5ef0cfe20
4 changed files with 40 additions and 11 deletions
|
@ -543,15 +543,12 @@ class User
|
|||
public static function getLanguageCode(int $uid, bool $short): string
|
||||
{
|
||||
$owner = self::getOwnerDataById($uid);
|
||||
$languages = DI::l10n()->getAvailableLanguages();
|
||||
$languages = DI::l10n()->getAvailableLanguages($short);
|
||||
if (in_array($owner['language'], array_keys($languages))) {
|
||||
$language = $owner['language'];
|
||||
} else {
|
||||
$language = DI::config()->get('system', 'language');
|
||||
}
|
||||
if ($short) {
|
||||
return substr($language, 0, 2);
|
||||
}
|
||||
return $language;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue