147 if (is_object($ilias))
149 require_once
"./Services/Logging/classes/class.ilLog.php";
150 $this->log =
new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,$ilias->getClientId(),ILIAS_LOG_ENABLED);
158 $this->lang_key = $a_lang_key;
160 $this->text = array();
161 $this->loaded_modules = array();
171 $this->lang_default = $ilIliasIniFile->readVariable(
"language",
"default");
172 if (is_object($ilSetting) && $ilSetting->get(
"language") !=
"")
174 $this->lang_default = $ilSetting->get(
"language");
176 $this->lang_user = $ilUser->prefs[
"language"];
180 if (!in_array($this->lang_key,$langs))
185 require_once(
'./Services/Language/classes/class.ilCachedLanguage.php');
187 if ($this->global_cache->isActive()) {
188 $this->cached_modules = $this->global_cache->getTranslations();
203 return $this->lang_default ? $this->lang_default :
'en';
215 function txtlng($a_module, $a_topic, $a_language)
217 if (strcmp($a_language, $this->lang_key) == 0)
219 return $this->
txt($a_topic);
235 function txt($a_topic, $a_default_lang_fallback_mod =
"")
243 self::$used_topics[$a_topic] = $a_topic;
246 if (isset($this->text[$a_topic]))
248 $translation = $this->text[$a_topic];
251 if ($translation ==
"" && $a_default_lang_fallback_mod !=
"")
254 if($this->lang_key != $this->lang_default)
257 $a_default_lang_fallback_mod, $a_topic);
260 if($translation ==
"" || $translation ==
"-".$a_topic.
"-")
263 $a_default_lang_fallback_mod, $a_topic);
268 if ($translation ==
"")
270 if (ILIAS_LOG_ENABLED && is_object($this->log))
272 $this->log->writeLanguageLog($a_topic,$this->lang_key);
274 return "-".$a_topic.
"-";
289 return isset($this->text[$a_topic]);
296 if (in_array($a_module, $this->loaded_modules))
301 $this->loaded_modules[] = $a_module;
304 self::$used_modules[$a_module] = $a_module;
308 if (empty($this->lang_key))
313 if(is_array($this->cached_modules[$a_module])) {
314 $this->text = array_merge($this->text, $this->cached_modules[$a_module]);
331 $q =
"SELECT * FROM lng_modules " .
332 "WHERE lang_key = ".$ilDB->quote($lang_key,
"text").
" AND module = ".
333 $ilDB->quote($a_module,
"text");
334 $r = $ilDB->query($q);
337 $new_text = unserialize(
$row[
"lang_array"]);
338 if (is_array($new_text))
340 $this->text = array_merge($this->text, $new_text);
347 include_once(
"./Services/Object/classes/class.ilObject.php");
350 foreach ($langlist as
$lang)
352 if (substr($lang[
"desc"], 0, 9) ==
"installed")
354 $languages[] = $lang[
"title"];
359 return $languages ? $languages : array();
366 $set = $ilDB->query($q = sprintf(
"SELECT * FROM lng_data WHERE module = %s ".
367 "AND lang_key = %s AND identifier = %s",
368 $ilDB->quote((
string) $a_mod,
"text"), $ilDB->quote((
string) $a_lang_key,
"text"),
369 $ilDB->quote((
string) $a_id,
"text")));
370 $rec = $ilDB->fetchAssoc($set);
372 if ($rec[
"value"] !=
"")
375 self::$used_topics[$a_id] = $a_id;
376 self::$used_modules[$a_mod] = $a_mod;
378 return $rec[
"value"];
381 return "-".$a_id.
"-";
394 $query =
'SELECT obj_id FROM object_data '.
' '.
395 'WHERE title = '.$ilDB->quote($a_lang_key,
'text').
' '.
396 'AND type = '.$ilDB->quote(
'lng',
'text');
409 asort(self::$used_topics);
410 return self::$used_topics;
415 asort(self::$used_modules);
416 return self::$used_modules;
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
static _lookupEntry($a_lang_key, $a_mod, $a_id)
txtlng($a_module, $a_topic, $a_language)
gets the text for a given topic in a given language if the topic is not in the list, the topic itself with "-" will be returned
const DB_FETCHMODE_OBJECT
exists($a_topic)
Check if language entry exists.
const ILIAS_ABSOLUTE_PATH
redirection script todo: (a better solution should control the processing via a xml file) ...
ilLanguage($a_lang_key)
Constructor read the single-language file and put this in an array text.
loadLanguageModule($a_module)
static lookupId($a_lang_key)
Lookup obj_id of language ilDB $ilDB.
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...