19 declare(strict_types=1);
45 $this->language_cache = $DIC->globalCache()->get($this);
79 if ($this->language_cache->has($key)) {
86 return is_array($v) ? $v : null;
90 $translations = $this->language_cache->get($key, $always);
91 if (is_array($translations)) {
114 $this->language_cache->delete(
"translations_" . $this->
getLanguageKey());
124 $ilDB = $DIC->database();
126 $q =
'SELECT module, lang_array FROM lng_modules WHERE lang_key = %s';
128 $translations = array();
129 while ($set =
$ilDB->fetchObject(
$res)) {
131 $lang_array = unserialize($set->lang_array, [
'allowed_classes' =>
false]);
135 if (is_array($lang_array)) {
136 $translations[$set->module] = $lang_array;
144 if (!isset(self::$instances[$key])) {
145 self::$instances[$key] =
new self($key);
148 return self::$instances[$key];
153 $this->language_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.
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.
ILIAS Cache Container Container $language_cache