ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLanguageDetection Class Reference

Class ilLanguageDetection. More...

+ Collaboration diagram for ilLanguageDetection:

Public Member Functions

 __construct ()
 
 detect ()
 

Protected Attributes

 $factory
 

Detailed Description

Class ilLanguageDetection.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de /

Definition at line 12 of file class.ilLanguageDetection.php.

Constructor & Destructor Documentation

◆ __construct()

ilLanguageDetection::__construct ( )

Definition at line 22 of file class.ilLanguageDetection.php.

23  {
24  $this->factory = new ilLanguageDetectorFactory();
25  }
Class ilLanguageDetectorFactory.

Member Function Documentation

◆ detect()

ilLanguageDetection::detect ( )
Returns
string

Definition at line 30 of file class.ilLanguageDetection.php.

References $DIC, $ilLog, $language, and ilLanguage\_getInstalledLanguages().

31  {
32  global $DIC;
33  $ilLog = $DIC->logger()->root();
34 
35  $installed_languages = ilLanguage::_getInstalledLanguages();
36  $detected_language = $installed_languages[0];
37 
38  foreach ($this->factory->getValidInstances() as $detector) {
39  try {
40  $language = $detector->getIso2LanguageCode();
41  if (in_array($language, $installed_languages)) {
42  $detected_language = $language;
43  }
44  } catch (ilLanguageException $e) {
45  $ilLog->info(__METHOD__ . ' ' . $e->getMessage());
46  }
47  }
48 
49  return $detected_language;
50  }
global $DIC
Definition: saml.php:7
Class for language related exception handling in ILIAS.
static _getInstalledLanguages()
+ Here is the call graph for this function:

Field Documentation

◆ $factory

ilLanguageDetection::$factory
protected

Definition at line 17 of file class.ilLanguageDetection.php.


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