19declare(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;
114 $this->language_cache->delete(
"translations_" . $this->
getLanguageKey());
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]);
132 }
catch (Throwable $t) {
135 if (is_array($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();
readFromDB()
Read data from table lng_module from DB.
ILIAS Cache Container Container $language_cache
setLanguageKey(string $language_key)
Set language key.
isActive()
Return whether the global cache is active.
readFromCache()
Read from cache.
deleteInCache()
Delete the cache entry for this language without flushing the whole global cache Using this function ...
setTranslations(array $translations)
Set translations.
getTranslations()
Return translations as array.
writeToCache()
Write to global cache.
getLanguageKey()
Return language key.
__construct(string $language_key)
ilCachedLanguage constructor.