mirror of
https://github.com/friendica/friendica
synced 2025-04-26 01:10:15 +00:00
New functions for the language library
This commit is contained in:
parent
64c8c2afdf
commit
595508a91f
4 changed files with 41 additions and 14 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue