ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLanguage Class Reference

language handling More...

+ Inheritance diagram for ilLanguage:
+ Collaboration diagram for ilLanguage:

Public Member Functions

 __construct ($a_lang_key)
 Constructor read the single-language file and put this in an array text. More...
 
 getLangKey ()
 
 getDefaultLanguage ()
 
 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 More...
 
 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 returned More...
 
 exists ($a_topic)
 Check if language entry exists. More...
 
 loadLanguageModule ($a_module)
 
 getInstalledLanguages ()
 
 getUsedTopics ()
 
 getUsedModules ()
 
 getUserLanguage ()
 
 toJS ($a_lang_key, ilGlobalTemplateInterface $a_tpl=null)
 
 toJSMap ($a_map, ilGlobalTemplateInterface $a_tpl=null)
 Transfer text to Javascript. More...
 
 __destruct ()
 destructor saves all language usages to db if log is enabled and ilDB exists More...
 

Static Public Member Functions

static _getInstalledLanguages ()
 
static _lookupEntry ($a_lang_key, $a_mod, $a_id)
 
static lookupId ($a_lang_key)
 Lookup obj_id of language ilDB $ilDB. More...
 
static getFallbackInstance ()
 Builds a global default language instance. More...
 
static getGlobalInstance ()
 Builds the global language object. More...
 

Data Fields

 $ilias
 
 $text
 
 $lang_default
 
 $lang_user
 
 $lang_path
 
 $lang_key
 
 $lang_name
 
 $separator = "#:#"
 
 $comment_separator = "###"
 
 $loaded_modules
 

Static Protected Member Functions

static logUsage ($a_module, $a_identifier)
 saves tupel of language module and identifier More...
 
static isUsageLogEnabled ()
 checks if language usage log is enabled you need MySQL to use this function this function is automatically enabled if DEVMODE is on this function is also enabled if language_log is 1 More...
 

Protected Attributes

 $cached_modules = array()
 
 $map_modules_txt = array()
 
 $usage_log_enabled = false
 

Static Protected Attributes

static $used_topics = array()
 
static $used_modules = array()
 
static $lng_log = array()
 

Detailed Description

language handling

this class offers the language handling for an application. it works initially on one file: languages.txt from this file the class can generate many single language files. the constructor is called with a small language abbreviation e.g. $lng = new Language("en"); the constructor reads the single-languagefile en.lang and puts this into an array. with e.g. $lng->txt("user_updated"); you can translate a lang-topic into the actual language

Author
Peter Gabriel pgabr.nosp@m.iel@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$
Todo:
Das Datefeld wird bei Aenderungen einer Sprache (update, install, deinstall) nicht richtig gesetzt!!! Die Formatfunktionen gehoeren nicht in class.Language. Die sind auch woanders einsetzbar!!! Daher->besser in class.Format

Definition at line 26 of file class.ilLanguage.php.

Constructor & Destructor Documentation

◆ __construct()

ilLanguage::__construct (   $a_lang_key)

Constructor read the single-language file and put this in an array text.

the text array is two-dimensional. First dimension is the language. Second dimension is the languagetopic. Content is the translation.

public

Parameters
stringlanguagecode (two characters), e.g. "de", "en", "in"
Returns
boolean false if reading failed

Definition at line 154 of file class.ilLanguage.php.

References $DIC, $ilIliasIniFile, $ilSetting, $ilUser, $lang_default, getInstalledLanguages(), ilCachedLanguage\getInstance(), and loadLanguageModule().

155  {
156  global $DIC;
157  $ilIliasIniFile = $DIC->iliasIni();
158 
159  $this->log = $DIC->logger()->lang();
160 
161  $this->lang_key = $a_lang_key;
162 
163  $this->text = array();
164  $this->loaded_modules = array();
165 
166  $this->usage_log_enabled = self::isUsageLogEnabled();
167 
168  $this->lang_path = ILIAS_ABSOLUTE_PATH . "/lang";
169  $this->cust_lang_path = ILIAS_ABSOLUTE_PATH . "/Customizing/global/lang";
170 
171  $this->lang_default = $ilIliasIniFile->readVariable("language", "default");
172 
173  if ($DIC->offsetExists('ilSetting')) {
174  $ilSetting = $DIC->settings();
175  if ($ilSetting->get("language") != "") {
176  $this->lang_default = $ilSetting->get("language");
177  }
178  }
179  if ($DIC->offsetExists('ilUser')) {
180  $ilUser = $DIC->user();
181  $this->lang_user = $ilUser->prefs["language"];
182  }
183 
184  $langs = $this->getInstalledLanguages();
185 
186  if (!in_array($this->lang_key, $langs)) {
187  $this->lang_key = $this->lang_default;
188  }
189 
190  require_once('./Services/Language/classes/class.ilCachedLanguage.php');
191  $this->global_cache = ilCachedLanguage::getInstance($this->lang_key);
192  if ($this->global_cache->isActive()) {
193  $this->cached_modules = $this->global_cache->getTranslations();
194  }
195 
196  $this->loadLanguageModule("common");
197 
198  return true;
199  }
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
loadLanguageModule($a_module)
$DIC
Definition: xapitoken.php:46
$ilIliasIniFile
+ Here is the call graph for this function:

◆ __destruct()

ilLanguage::__destruct ( )

destructor saves all language usages to db if log is enabled and ilDB exists

Definition at line 594 of file class.ilLanguage.php.

References $DIC, $ilDB, and $query.

595  {
596  global $DIC;
597 
598  //case $ilDB not existing should not happen but if something went wrong it shouldn't leads to any failures
599  if (!$this->usage_log_enabled || !$DIC->isDependencyAvailable("database")) {
600  return;
601  }
602 
603  $ilDB = $DIC->database();
604 
605  foreach ((array) self::$lng_log as $identifier => $module) {
606  $wave[] = '(' . $ilDB->quote($module, 'text') . ', ' . $ilDB->quote($identifier, 'text') . ')';
607  unset(self::$lng_log[$identifier]);
608 
609  if (count($wave) == 150 || (count(self::$lng_log) == 0 && count($wave) > 0)) {
610  $query = 'REPLACE INTO lng_log (module, identifier) VALUES ' . implode(', ', $wave);
611  $ilDB->manipulate($query);
612 
613  $wave = array();
614  }
615  }
616  }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46

Member Function Documentation

◆ _getInstalledLanguages()

static ilLanguage::_getInstalledLanguages ( )
static

Definition at line 350 of file class.ilLanguage.php.

References $lang, and ilObject\_getObjectsByType().

Referenced by ilLanguageDetection\detect().

351  {
352  include_once("./Services/Object/classes/class.ilObject.php");
353  $langlist = ilObject::_getObjectsByType("lng");
354 
355  foreach ($langlist as $lang) {
356  if (substr($lang["desc"], 0, 9) == "installed") {
357  $languages[] = $lang["title"];
358  }
359  }
360 
361  return $languages ? $languages : array();
362  }
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
$lang
Definition: xapiexit.php:8
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupEntry()

static ilLanguage::_lookupEntry (   $a_lang_key,
  $a_mod,
  $a_id 
)
static

Definition at line 364 of file class.ilLanguage.php.

References $DIC, and $ilDB.

Referenced by ilLinkChecker\__txt(), ilObjLTIAdministrationGUI\getConsumerForm(), ilPersonalSettingsGUI\initGeneralSettingsForm(), ilAccountMail\replacePlaceholders(), ilUserCronCheckAccounts\txt(), txt(), and txtlng().

365  {
366  global $DIC;
367  $ilDB = $DIC->database();
368 
369  $set = $ilDB->query($q = sprintf(
370  "SELECT * FROM lng_data WHERE module = %s " .
371  "AND lang_key = %s AND identifier = %s",
372  $ilDB->quote((string) $a_mod, "text"),
373  $ilDB->quote((string) $a_lang_key, "text"),
374  $ilDB->quote((string) $a_id, "text")
375  ));
376  $rec = $ilDB->fetchAssoc($set);
377 
378  if ($rec["value"] != "") {
379  // remember the used topics
380  self::$used_topics[$a_id] = $a_id;
381  self::$used_modules[$a_mod] = $a_mod;
382 
383  if (self::isUsageLogEnabled()) {
384  self::logUsage($a_mod, $a_id);
385  }
386 
387  return $rec["value"];
388  }
389 
390  return "-" . $a_id . "-";
391  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ exists()

ilLanguage::exists (   $a_topic)

Check if language entry exists.

Parameters
object$a_topic
Returns

Definition at line 289 of file class.ilLanguage.php.

290  {
291  return isset($this->text[$a_topic]);
292  }

◆ getDefaultLanguage()

ilLanguage::getDefaultLanguage ( )

Definition at line 206 of file class.ilLanguage.php.

207  {
208  return $this->lang_default ? $this->lang_default : 'en';
209  }

◆ getFallbackInstance()

static ilLanguage::getFallbackInstance ( )
static

Builds a global default language instance.

Returns

Definition at line 437 of file class.ilLanguage.php.

Referenced by ilInitialisation\goToLogin().

438  {
439  return new self('en');
440  }
+ Here is the caller graph for this function:

◆ getGlobalInstance()

static ilLanguage::getGlobalInstance ( )
static

Builds the global language object.

Returns
self

Definition at line 446 of file class.ilLanguage.php.

References $_GET, $_POST, $DIC, $ilSetting, $ilUser, ilSession\get(), ilSession\set(), and ilUtil\stripSlashes().

Referenced by ilInitialisation\goToLogin().

447  {
448  global $DIC;
449  $ilSetting = $DIC->settings();
450  if ($DIC->offsetExists('ilUser')) {
451  $ilUser = $DIC->user();
452  }
453 
454  if (!ilSession::get('lang') && !$_GET['lang']) {
455  if (
456  $ilUser instanceof ilObjUser &&
457  (!$ilUser->getId() || $ilUser->isAnonymous())
458  ) {
459  require_once 'Services/Language/classes/class.ilLanguageDetection.php';
460  $language_detection = new ilLanguageDetection();
461  $language = $language_detection->detect();
462 
463  $ilUser->setPref('language', $language);
464  $_GET['lang'] = $language;
465  }
466  }
467 
468  if (isset($_POST['change_lang_to']) && $_POST['change_lang_to'] != "") {
469  $_GET['lang'] = ilUtil::stripSlashes($_POST['change_lang_to']);
470  }
471 
472  // prefer personal setting when coming from login screen
473  // Added check for ilUser->getId > 0 because it is 0 when the language is changed and the terms of service should be displayed
474  if (
475  $ilUser instanceof ilObjUser &&
476  ($ilUser->getId() && !$ilUser->isAnonymous())
477  ) {
478  ilSession::set('lang', $ilUser->getPref('language'));
479  }
480 
481  ilSession::set('lang', (isset($_GET['lang']) && $_GET['lang']) ? $_GET['lang'] : ilSession::get('lang'));
482 
483  // check whether lang selection is valid
484  $langs = self::_getInstalledLanguages();
485  if (!in_array(ilSession::get('lang'), $langs)) {
486  if ($ilSetting instanceof ilSetting && $ilSetting->get('language') != '') {
487  ilSession::set('lang', $ilSetting->get('language'));
488  } else {
489  ilSession::set('lang', $langs[0]);
490  }
491  }
492  $_GET['lang'] = ilSession::get('lang');
493 
494  return new self(ilSession::get('lang'));
495  }
$_GET["client_id"]
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
Class ilLanguageDetection.
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstalledLanguages()

ilLanguage::getInstalledLanguages ( )

Definition at line 345 of file class.ilLanguage.php.

Referenced by __construct().

346  {
347  return self::_getInstalledLanguages();
348  }
+ Here is the caller graph for this function:

◆ getLangKey()

ilLanguage::getLangKey ( )

Definition at line 201 of file class.ilLanguage.php.

References $lang_key.

Referenced by ilForumCronNotificationDataProvider\getAuthorInformation().

202  {
203  return $this->lang_key;
204  }
+ Here is the caller graph for this function:

◆ getUsedModules()

ilLanguage::getUsedModules ( )

Definition at line 422 of file class.ilLanguage.php.

423  {
424  asort(self::$used_modules);
425  return self::$used_modules;
426  }

◆ getUsedTopics()

ilLanguage::getUsedTopics ( )

Definition at line 416 of file class.ilLanguage.php.

417  {
418  asort(self::$used_topics);
419  return self::$used_topics;
420  }

◆ getUserLanguage()

ilLanguage::getUserLanguage ( )

Definition at line 428 of file class.ilLanguage.php.

References $lang_user.

429  {
430  return $this->lang_user;
431  }

◆ isUsageLogEnabled()

static ilLanguage::isUsageLogEnabled ( )
staticprotected

checks if language usage log is enabled you need MySQL to use this function this function is automatically enabled if DEVMODE is on this function is also enabled if language_log is 1

Returns
bool

Definition at line 571 of file class.ilLanguage.php.

References $DIC, and $ilDB.

572  {
573  global $DIC;
574  $ilClientIniFile = $DIC->clientIni();
575  $ilDB = $DIC->database();
576 
577  if (!(($ilDB instanceof ilDBMySQL) || ($ilDB instanceof ilDBPdoMySQLMyISAM)) || !$ilClientIniFile instanceof ilIniFile) {
578  return false;
579  }
580 
581  if (DEVMODE) {
582  return true;
583  }
584 
585  if (!$ilClientIniFile->variableExists('system', 'LANGUAGE_LOG')) {
586  return $ilClientIniFile->readVariable('system', 'LANGUAGE_LOG') == 1;
587  }
588  return false;
589  }
Class ilDBPdoMySQLMyISAM.
global $ilDB
$DIC
Definition: xapitoken.php:46
INIFile Parser.

◆ loadLanguageModule()

ilLanguage::loadLanguageModule (   $a_module)

Definition at line 294 of file class.ilLanguage.php.

References $DIC, $ilDB, $lang_key, $lang_user, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilDefaultPlaceholderDescription\__construct(), ilObjStudyProgrammeIndividualPlanGUI\__construct(), ilCertificateLearningHistoryProvider\__construct(), ilObjStudyProgrammeMembersGUI\__construct(), ilObjStudyProgrammeTreeGUI\__construct(), ilObjStudyProgrammeSettingsGUI\__construct(), __construct(), and ilObjUserGUI\showUpperIcon().

295  {
296  global $DIC;
297  $ilDB = $DIC->database();
298 
299  if (in_array($a_module, $this->loaded_modules)) {
300  return;
301  }
302 
303  $this->loaded_modules[] = $a_module;
304 
305  // remember the used modules globally
306  self::$used_modules[$a_module] = $a_module;
307 
309 
310  if (empty($this->lang_key)) {
312  }
313 
314  if (is_array($this->cached_modules[$a_module])) {
315  $this->text = array_merge($this->text, $this->cached_modules[$a_module]);
316 
317  if ($this->usage_log_enabled) {
318  foreach (array_keys($this->cached_modules[$a_module]) as $key) {
319  $this->map_modules_txt[$key] = $a_module;
320  }
321  }
322 
323  return;
324  }
325 
326  $q = "SELECT * FROM lng_modules " .
327  "WHERE lang_key = " . $ilDB->quote($lang_key, "text") . " AND module = " .
328  $ilDB->quote($a_module, "text");
329  $r = $ilDB->query($q);
330  $row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
331 
332  $new_text = unserialize($row["lang_array"]);
333  if (is_array($new_text)) {
334  $this->text = array_merge($this->text, $new_text);
335 
336  if ($this->usage_log_enabled) {
337  foreach (array_keys($new_text) as $key) {
338  $this->map_modules_txt[$key] = $a_module;
339  }
340  }
341  }
342  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ logUsage()

static ilLanguage::logUsage (   $a_module,
  $a_identifier 
)
staticprotected

saves tupel of language module and identifier

Parameters
string$a_module
string$a_identifier

Definition at line 556 of file class.ilLanguage.php.

557  {
558  if ($a_module != "" && $a_identifier != "") {
559  self::$lng_log[$a_identifier] = $a_module;
560  }
561  }

◆ lookupId()

static ilLanguage::lookupId (   $a_lang_key)
static

Lookup obj_id of language ilDB $ilDB.

Parameters
string$a_lang_key
Returns
int

Definition at line 399 of file class.ilLanguage.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilStartUpGUI\getLoginPageEditorHTML(), and ilAuthLoginPageEditorTableGUI\parse().

400  {
401  global $DIC;
402  $ilDB = $DIC->database();
403 
404  $query = 'SELECT obj_id FROM object_data ' . ' ' .
405  'WHERE title = ' . $ilDB->quote($a_lang_key, 'text') . ' ' .
406  'AND type = ' . $ilDB->quote('lng', 'text');
407 
408  $res = $ilDB->query($query);
409  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
410  return $row->obj_id;
411  }
412  return 0;
413  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ toJS()

ilLanguage::toJS (   $a_lang_key,
ilGlobalTemplateInterface  $a_tpl = null 
)

Definition at line 503 of file class.ilLanguage.php.

References $DIC, $tpl, toJSMap(), and txt().

504  {
505  global $DIC;
506  $tpl = $DIC['tpl'];
507 
508  if (!is_object($a_tpl)) {
509  $a_tpl = $tpl;
510  }
511 
512  if (!is_array($a_lang_key)) {
513  $a_lang_key = array($a_lang_key);
514  }
515 
516  $map = array();
517  foreach ($a_lang_key as $lk) {
518  $map[$lk] = $this->txt($lk);
519  }
520  $this->toJSMap($map, $a_tpl);
521  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
toJSMap($a_map, ilGlobalTemplateInterface $a_tpl=null)
Transfer text to Javascript.
$DIC
Definition: xapitoken.php:46
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...
+ Here is the call graph for this function:

◆ toJSMap()

ilLanguage::toJSMap (   $a_map,
ilGlobalTemplateInterface  $a_tpl = null 
)

Transfer text to Javascript.

Parameters
array$a_maparray of key value pairs (key is text string, value is content)
ilTemplate$a_tpltemplate

Definition at line 529 of file class.ilLanguage.php.

References $DIC, $tpl, and ilJsonUtil\encode().

Referenced by toJS().

530  {
531  global $DIC;
532  $tpl = $DIC['tpl'];
533 
534  if (!is_object($a_tpl)) {
535  $a_tpl = $tpl;
536  }
537 
538  if (!is_array($a_map)) {
539  return;
540  }
541 
542  foreach ($a_map as $k => $v) {
543  if ($v != "") {
544  include_once("./Services/JSON/classes/class.ilJsonUtil.php");
545  $a_tpl->addOnloadCode("il.Language.setLangVar('" . $k . "', " . ilJsonUtil::encode($v) . ");");
546  }
547  }
548  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static encode($mixed, $suppress_native=false)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ txt()

ilLanguage::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 returned

public

Parameters
stringtopic
Returns
string text clear-text

Definition at line 237 of file class.ilLanguage.php.

References _lookupEntry().

Referenced by ilDefaultPlaceholderDescription\__construct(), ilTestRandomQuestionsSrcPoolDefinitionQuantitiesCalculation\buildIntersectionQuestionSharingDefinitionsString(), assKprimChoice\getAnswerTypeSelectOptions(), ilTestRandomQuestionsSrcPoolDefinitionQuantitiesCalculation\getConcurrentRuleConflictMessage(), ilObjTestDynamicQuestionSetConfig\getDepenciesBrokenMessage(), ilTestRandomQuestionSetConfig\getDepenciesBrokenMessage(), ilObjTestDynamicQuestionSetConfig\getDepenciesInVulnerableStateMessage(), ilAssQuestionSkillAssignmentImportFails\getFailedImportsMessage(), ilTestSkillLevelThresholdImportFails\getFailedImportsMessage(), assKprimChoice\getFalseOptionLabelTranslation(), ilAssLacConditionParserException\getFormAlert(), ilAssLacDuplicateElement\getFormAlert(), ilAssLacMissingBracket\getFormAlert(), ilAssLacQuestionNotExist\getFormAlert(), ilAssLacQuestionNotReachable\getFormAlert(), ilAssLacUnsupportedExpression\getFormAlert(), ilAssLacUnsupportedOperation\getFormAlert(), ilAssLacUnableToParseCondition\getFormAlert(), ilAssLacOperatorNotSupportedByExpression\getFormAlert(), ilAssLacAnswerIndexNotExist\getFormAlert(), ilAssLacExpressionNotSupportedByQuestion\getFormAlert(), ilAssLacAnswerValueNotExist\getFormAlert(), ilAssQuestionHint\getHintIndexLabel(), assKprimChoice\getInstructionTextTranslation(), ilLearningModuleNotification\getMailBody(), ilLearningModuleNotification\getMailSubject(), ilTestRandomQuestionSetSourcePoolDefinition\getPoolInfoLabel(), ilLearningModuleNotification\getPreviewText(), ilObjTest\getQuestionSetTypeTranslation(), ilTestRandomQuestionsSrcPoolDefinitionQuantitiesCalculation\getRuleSatisfactionResultMessage(), ilObjTestDynamicQuestionSetConfig\getSourceQuestionPoolSummaryString(), ilStudyProgrammeAssessmentSettings\getStatusOptions(), ilAssQuestionLifecycle\getTranslationByIdentifier(), assKprimChoice\getTrueOptionLabelTranslation(), assKprimChoice\getValidOptionLabelsTranslated(), ilCmiXapiVerbList\getVerbTranslation(), ilStudyProgrammeTypeSettings\toFormInput(), ilStudyProgrammeDeadlineSettings\toFormInput(), ilStudyProgrammeTypeInfo\toFormInput(), ilIndividualAssessmentInfoSettings\toFormInput(), ilStudyProgrammeAssessmentSettings\toFormInput(), ilStudyProgrammeValidityOfAchievedQualificationSettings\toFormInput(), ilStudyProgrammeAutoMailSettings\toFormInput(), ilIndividualAssessmentSettings\toFormInput(), ilIndividualAssessmentUserGrading\toFormInput(), toJS(), and txtlng().

238  {
239  if (empty($a_topic)) {
240  return "";
241  }
242 
243  // remember the used topics
244  self::$used_topics[$a_topic] = $a_topic;
245 
246  $translation = "";
247  if (isset($this->text[$a_topic])) {
248  $translation = $this->text[$a_topic];
249  }
250 
251  if ($translation == "" && $a_default_lang_fallback_mod != "") {
252  // #13467 - try current language first (could be missing module)
253  if ($this->lang_key != $this->lang_default) {
254  $translation = ilLanguage::_lookupEntry(
255  $this->lang_key,
256  $a_default_lang_fallback_mod,
257  $a_topic
258  );
259  }
260  // try default language last
261  if ($translation == "" || $translation == "-" . $a_topic . "-") {
262  $translation = ilLanguage::_lookupEntry(
263  $this->lang_default,
264  $a_default_lang_fallback_mod,
265  $a_topic
266  );
267  }
268  }
269 
270 
271  if ($translation == "") {
272  if (ILIAS_LOG_ENABLED && is_object($this->log)) {
273  $this->log->debug("Language (" . $this->lang_key . "): topic -" . $a_topic . "- not present");
274  }
275  return "-" . $a_topic . "-";
276  } else {
277  if ($this->usage_log_enabled) {
278  self::logUsage($this->map_modules_txt[$a_topic], $a_topic);
279  }
280  return $translation;
281  }
282  }
static _lookupEntry($a_lang_key, $a_mod, $a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ txtlng()

ilLanguage::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

public

Parameters
stringtopic
string$a_languageThe language of the output string
Returns
string text clear-text

Definition at line 220 of file class.ilLanguage.php.

References _lookupEntry(), and txt().

221  {
222  if (strcmp($a_language, $this->lang_key) == 0) {
223  return $this->txt($a_topic);
224  } else {
225  return ilLanguage::_lookupEntry($a_language, $a_module, $a_topic);
226  }
227  }
static _lookupEntry($a_lang_key, $a_mod, $a_id)
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...
+ Here is the call graph for this function:

Field Documentation

◆ $cached_modules

ilLanguage::$cached_modules = array()
protected

Definition at line 127 of file class.ilLanguage.php.

◆ $comment_separator

ilLanguage::$comment_separator = "###"

Definition at line 103 of file class.ilLanguage.php.

◆ $ilias

ilLanguage::$ilias

Definition at line 34 of file class.ilLanguage.php.

◆ $lang_default

ilLanguage::$lang_default

Definition at line 51 of file class.ilLanguage.php.

Referenced by __construct().

◆ $lang_key

ilLanguage::$lang_key

Definition at line 79 of file class.ilLanguage.php.

Referenced by getLangKey(), and loadLanguageModule().

◆ $lang_name

ilLanguage::$lang_name

Definition at line 87 of file class.ilLanguage.php.

◆ $lang_path

ilLanguage::$lang_path

Definition at line 71 of file class.ilLanguage.php.

◆ $lang_user

ilLanguage::$lang_user

Definition at line 61 of file class.ilLanguage.php.

Referenced by getUserLanguage(), and loadLanguageModule().

◆ $lng_log

ilLanguage::$lng_log = array()
staticprotected

Definition at line 142 of file class.ilLanguage.php.

◆ $loaded_modules

ilLanguage::$loaded_modules

Definition at line 111 of file class.ilLanguage.php.

◆ $map_modules_txt

ilLanguage::$map_modules_txt = array()
protected

Definition at line 132 of file class.ilLanguage.php.

◆ $separator

ilLanguage::$separator = "#:#"

Definition at line 95 of file class.ilLanguage.php.

◆ $text

ilLanguage::$text

Definition at line 42 of file class.ilLanguage.php.

◆ $usage_log_enabled

ilLanguage::$usage_log_enabled = false
protected

Definition at line 137 of file class.ilLanguage.php.

◆ $used_modules

ilLanguage::$used_modules = array()
staticprotected

Definition at line 123 of file class.ilLanguage.php.

◆ $used_topics

ilLanguage::$used_topics = array()
staticprotected

Definition at line 117 of file class.ilLanguage.php.


The documentation for this class was generated from the following file: