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 $this->log =
new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,$ilias->getClientId(),ILIAS_LOG_ENABLED);
148 $this->lang_key = $a_lang_key;
150 $this->text = array();
151 $this->loaded_modules = array();
161 $this->lang_default = $ilIliasIniFile->readVariable(
"language",
"default");
162 if (is_object($ilSetting) && $ilSetting->get(
"language") !=
"")
164 $this->lang_default = $ilSetting->get(
"language");
166 $this->lang_user = $ilUser->prefs[
"language"];
170 if (!in_array($this->lang_key,$langs))
187 return $this->lang_default ? $this->lang_default :
'en';
199 function txtlng($a_module, $a_topic, $a_language)
201 if (strcmp($a_language, $this->lang_key) == 0)
203 return $this->
txt($a_topic);
219 function txt($a_topic, $a_default_lang_fallback_mod =
"")
227 $this->used_topics[$a_topic] = $a_topic;
230 if (isset($this->text[$a_topic]))
232 $translation = $this->text[$a_topic];
235 if ($translation ==
"" && $a_default_lang_fallback_mod !=
"")
238 $a_default_lang_fallback_mod, $a_topic);
242 if ($translation ==
"")
244 if (ILIAS_LOG_ENABLED && is_object($this->log))
246 $this->log->writeLanguageLog($a_topic,$this->lang_key);
248 return "-".$a_topic.
"-";
263 return isset($this->text[$a_topic]);
270 if (in_array($a_module, $this->loaded_modules))
275 $this->loaded_modules[] = $a_module;
278 $this->used_modules[$a_module] = $a_module;
282 if (empty($this->lang_key))
299 $q =
"SELECT * FROM lng_modules " .
300 "WHERE lang_key = ".$ilDB->quote(
$lang_key,
"text").
" AND module = ".
301 $ilDB->quote($a_module,
"text");
302 $r = $ilDB->query($q);
305 $new_text = unserialize(
$row[
"lang_array"]);
306 if (is_array($new_text))
308 $this->text = array_merge($this->text, $new_text);
315 include_once(
"./Services/Object/classes/class.ilObject.php");
318 foreach ($langlist as
$lang)
320 if (substr($lang[
"desc"], 0, 9) ==
"installed")
322 $languages[] = $lang[
"title"];
327 return $languages ? $languages : array();
334 $set = $ilDB->query($q = sprintf(
"SELECT * FROM lng_data WHERE module = %s ".
335 "AND lang_key = %s AND identifier = %s",
336 $ilDB->quote((
string) $a_mod,
"text"), $ilDB->quote((
string) $a_lang_key,
"text"),
337 $ilDB->quote((
string) $a_id,
"text")));
338 $rec = $ilDB->fetchAssoc($set);
340 if ($rec[
"value"] !=
"")
343 $this->used_topics[$a_id] = $a_id;
344 $this->used_modules[$a_mod] = $a_mod;
346 return $rec[
"value"];
349 return "-".$a_id.
"-";
362 $query =
'SELECT obj_id FROM object_data '.
' '.
363 'WHERE title = '.$ilDB->quote($a_lang_key,
'text').
' '.
364 'AND type = '.$ilDB->quote(
'lng',
'text');
377 if (is_array($this->used_topics))
379 asort($this->used_topics);
380 return $this->used_topics;
390 if (is_array($this->used_modules))
392 asort($this->used_modules);
393 return $this->used_modules;