ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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.

31 {
32 global $DIC;
33 $ilLog = $DIC->logger()->lang();
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->warning($e->getMessage());
46 }
47 }
48
49 return $detected_language;
50 }
Class for language related exception handling in ILIAS.
static _getInstalledLanguages()
$DIC
Definition: xapitoken.php:46

References $DIC, Vendor\Package\$e, $ilLog, and ilLanguage\_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: