ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilLanguageFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
30 {
31  private static array $languages = array();
32 
36  public static function _getLanguage(string $a_lang_key = ''): ilLanguage
37  {
38  global $DIC;
39  $lng = $DIC->language();
40 
41  if (!$a_lang_key) {
42  if (is_object($lng)) {
43  $a_lang_key = $lng->getDefaultLanguage();
44  } else {
45  $a_lang_key = "en";
46  }
47  }
48 
49  return self::$languages[$a_lang_key] ?? (self::$languages[$a_lang_key] = new ilLanguage($a_lang_key));
50  }
51 
56  public static function _getLanguageOfUser(int $a_usr_id): ilLanguage
57  {
58  return self::_getLanguage(ilObjUser::_lookupLanguage($a_usr_id));
59  }
60 }
static _lookupLanguage(int $a_usr_id)
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
global $DIC
Definition: shib_login.php:22
static _getLanguage(string $a_lang_key='')
Get language object.
global $lng
Definition: privfeed.php:31