ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLanguageDetection Class Reference

Class ilLanguageDetection. More...

+ Collaboration diagram for ilLanguageDetection:

Public Member Functions

 __construct ()
 
 detect ()
 Return detected language. More...
 

Protected Attributes

ilLanguageDetectorFactory $factory
 

Detailed Description

Class ilLanguageDetection.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLanguageDetection::__construct ( )

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

31 {
33 }
factory()
Class ilLanguageDetectorFactory.

References factory().

+ Here is the call graph for this function:

Member Function Documentation

◆ detect()

ilLanguageDetection::detect ( )

Return detected language.

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

38 : string
39 {
40 global $DIC;
41 $ilLog = $DIC->logger()->lang();
42
43 $installed_languages = ilLanguage::_getInstalledLanguages();
44 $detected_language = $installed_languages[0];
45
46 foreach ($this->factory->getValidInstances() as $detector) {
47 try {
48 $language = $detector->getIso2LanguageCode();
49 if (in_array($language, $installed_languages, true)) {
50 $detected_language = $language;
51 }
52 } catch (ilLanguageException $e) {
53 $ilLog->warning($e->getMessage());
54 }
55 }
56
57 return $detected_language;
58 }
Class for language related exception handling in ILIAS.
static _getInstalledLanguages()
Get installed languages.
global $DIC
Definition: shib_login.php:26

References $DIC, Vendor\Package\$e, ilLanguage\_getInstalledLanguages(), and factory().

+ Here is the call graph for this function:

Field Documentation

◆ $factory

ilLanguageDetectorFactory ilLanguageDetection::$factory
protected

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


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