129 global $ilias_lang_used_topics;
130 global $ilias_lang_used_modules;
131 $this->used_topics =& $ilias_lang_used_topics;
132 $this->used_modules =& $ilias_lang_used_modules;
138 if (is_object($ilias))
140 require_once
"./Services/Logging/classes/class.ilLog.php";
141 $this->log =
new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,$ilias->getClientId(),ILIAS_LOG_ENABLED);
149 $this->lang_key = $a_lang_key;
151 $this->text = array();
152 $this->loaded_modules = array();
162 $this->lang_default = $ilIliasIniFile->readVariable(
"language",
"default");
163 if (is_object($ilSetting) && $ilSetting->get(
"language") !=
"")
165 $this->lang_default = $ilSetting->get(
"language");
167 $this->lang_user = $ilUser->prefs[
"language"];
171 if (!in_array($this->lang_key,$langs))
188 return $this->lang_default ? $this->lang_default :
'en';
200 function txtlng($a_module, $a_topic, $a_language)
202 if (strcmp($a_language, $this->lang_key) == 0)
204 return $this->
txt($a_topic);
220 function txt($a_topic, $a_default_lang_fallback_mod =
"")
228 $this->used_topics[$a_topic] = $a_topic;
231 if (isset($this->text[$a_topic]))
233 $translation = $this->text[$a_topic];
236 if ($translation ==
"" && $a_default_lang_fallback_mod !=
"")
239 if($this->lang_key != $this->lang_default)
242 $a_default_lang_fallback_mod, $a_topic);
245 if($translation ==
"" || $translation ==
"-".$a_topic.
"-")
248 $a_default_lang_fallback_mod, $a_topic);
253 if ($translation ==
"")
255 if (ILIAS_LOG_ENABLED && is_object($this->log))
257 $this->log->writeLanguageLog($a_topic,$this->lang_key);
259 return "-".$a_topic.
"-";
274 return isset($this->text[$a_topic]);
281 if (in_array($a_module, $this->loaded_modules))
286 $this->loaded_modules[] = $a_module;
289 $this->used_modules[$a_module] = $a_module;
293 if (empty($this->lang_key))
310 $q =
"SELECT * FROM lng_modules " .
311 "WHERE lang_key = ".$ilDB->quote($lang_key,
"text").
" AND module = ".
312 $ilDB->quote($a_module,
"text");
313 $r = $ilDB->query($q);
316 $new_text = unserialize(
$row[
"lang_array"]);
317 if (is_array($new_text))
319 $this->text = array_merge($this->text, $new_text);
326 include_once(
"./Services/Object/classes/class.ilObject.php");
329 foreach ($langlist as
$lang)
331 if (substr($lang[
"desc"], 0, 9) ==
"installed")
333 $languages[] = $lang[
"title"];
338 return $languages ? $languages : array();
345 $set = $ilDB->query($q = sprintf(
"SELECT * FROM lng_data WHERE module = %s ".
346 "AND lang_key = %s AND identifier = %s",
347 $ilDB->quote((
string) $a_mod,
"text"), $ilDB->quote((
string) $a_lang_key,
"text"),
348 $ilDB->quote((
string) $a_id,
"text")));
349 $rec = $ilDB->fetchAssoc($set);
351 if ($rec[
"value"] !=
"")
354 $this->used_topics[$a_id] = $a_id;
355 $this->used_modules[$a_mod] = $a_mod;
357 return $rec[
"value"];
360 return "-".$a_id.
"-";
373 $query =
'SELECT obj_id FROM object_data '.
' '.
374 'WHERE title = '.$ilDB->quote($a_lang_key,
'text').
' '.
375 'AND type = '.$ilDB->quote(
'lng',
'text');
388 if (is_array($this->used_topics))
390 asort($this->used_topics);
391 return $this->used_topics;
401 if (is_array($this->used_modules))
403 asort($this->used_modules);
404 return $this->used_modules;
_lookupEntry($a_lang_key, $a_mod, $a_id)
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
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...