3 declare(strict_types=1);
22 require_once
"./Services/GlobalCache/classes/class.ilGlobalCache.php";
58 return $this->global_cache->isActive();
66 if ($this->global_cache->isActive()) {
67 $translations = $this->global_cache->get(
"translations_" . $this->
getLanguageKey());
68 if (is_array($translations)) {
80 if ($this->global_cache->isActive()) {
93 if ($this->global_cache->isActive()) {
94 $this->global_cache->delete(
"translations_" . $this->
getLanguageKey());
105 $ilDB = $DIC->database();
107 $q =
'SELECT module, lang_array FROM lng_modules WHERE lang_key = %s';
109 $translations = array();
110 while ($set =
$ilDB->fetchObject(
$res)) {
112 $lang_array = unserialize($set->lang_array, [
'allowed_classes' =>
false]);
116 if (is_array($lang_array)) {
117 $translations[$set->module] = $lang_array;
125 if (!isset(self::$instances[
$key])) {
126 self::$instances[
$key] =
new self(
$key);
129 return self::$instances[
$key];
134 if ($this->global_cache->isActive()) {
135 $this->global_cache->flush();
getTranslations()
Return translations as array.
setLanguageKey(string $language_key)
Set language key.
writeToCache()
Write to global cache.
__construct(string $language_key)
ilCachedLanguage constructor.
isActive()
Return whether the global cache is active.
ilGlobalCache $global_cache
deleteInCache()
Delete the cache entry for this language without flushing the whole global cache Using this function ...
readFromDB()
Read data from table lng_module from DB.
readFromCache()
Read from cache.
getLanguageKey()
Return language key.
setTranslations(array $translations)
Set translations.
static getInstance(?string $component)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...