ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLanguageFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
31 {
32  private static array $languages = array();
33 
37  public static function _getLanguage(string $a_lang_key = ''): ilLanguage
38  {
39  global $DIC;
40  $lng = $DIC->language();
41 
42  if (!$a_lang_key) {
43  if (is_object($lng)) {
44  $a_lang_key = $lng->getDefaultLanguage();
45  } else {
46  $a_lang_key = "en";
47  }
48  }
49 
50  return self::$languages[$a_lang_key] ?? (self::$languages[$a_lang_key] = new ilLanguage($a_lang_key));
51  }
52 
57  public static function _getLanguageOfUser(int $a_usr_id): ilLanguage
58  {
59  return self::_getLanguage(ilObjUser::_lookupLanguage($a_usr_id));
60  }
61 }
static _lookupLanguage(int $a_usr_id)
$lng
global $DIC
Definition: feed.php:28
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
static _getLanguage(string $a_lang_key='')
Get language object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...