ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLanguageDetectorFactory Class Reference

Class ilLanguageDetectorFactory. More...

+ Collaboration diagram for ilLanguageDetectorFactory:

Public Member Functions

 getValidInstances ()
 
 createDetectorByType ($type)
 

Data Fields

const DEFAULT_DETECTOR = 1
 
const HTTP_REQUEST_DETECTOR = 2
 

Protected Attributes

 $client_ini
 
 $request_information = array()
 
 $settings
 

Detailed Description

Member Function Documentation

◆ createDetectorByType()

ilLanguageDetectorFactory::createDetectorByType (   $type)
Parameters
int$type
Exceptions
ilLanguageException
Returns
ilLanguageDetector

Definition at line 70 of file class.ilLanguageDetectorFactory.php.

Referenced by getValidInstances().

71  {
72  switch($type)
73  {
74  case self::HTTP_REQUEST_DETECTOR:
75  require_once 'Services/Language/classes/class.ilHttpRequestsLanguageDetector.php';
76  return new ilHttpRequestsLanguageDetector($this->request_information['HTTP_ACCEPT_LANGUAGE']);
77 
78  case self::DEFAULT_DETECTOR:
79  require_once 'Services/Language/classes/class.ilDefaultLanguageDetector.php';
80  return new ilDefaultLanguageDetector($this->client_ini);
81  }
82 
83  require_once 'Services/Language/exceptions/class.ilLanguageException.php';
84  throw new ilLanguageException(__METHOD__ . sprintf('Cannot create language detector instance for type %s!', $type));
85  }
Class for language related exception handling in ILIAS.
Class ilDefaultLanguageDetector.
Class ilHttpRequestsLanguageDetector.
+ Here is the caller graph for this function:

◆ getValidInstances()

ilLanguageDetectorFactory::getValidInstances ( )
Returns
ilLanguageDetector[]

Definition at line 48 of file class.ilLanguageDetectorFactory.php.

References array, createDetectorByType(), settings(), and ilContext\usesHTTP().

49  {
50  $detectors = array(
51  $this->createDetectorByType(self::DEFAULT_DETECTOR)
52  );
53 
54  if(
55  $this->settings->get('lang_detection') &&
57  )
58  {
59  $detectors[] = $this->createDetectorByType(self::HTTP_REQUEST_DETECTOR);
60  }
61 
62  return $detectors;
63  }
static usesHTTP()
Uses HTTP aka browser.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Field Documentation

◆ $client_ini

ilLanguageDetectorFactory::$client_ini
protected

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

◆ $request_information

ilLanguageDetectorFactory::$request_information = array()
protected

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

◆ $settings

ilLanguageDetectorFactory::$settings
protected

Definition at line 27 of file class.ilLanguageDetectorFactory.php.

◆ DEFAULT_DETECTOR

const ilLanguageDetectorFactory::DEFAULT_DETECTOR = 1

Definition at line 11 of file class.ilLanguageDetectorFactory.php.

◆ HTTP_REQUEST_DETECTOR

const ilLanguageDetectorFactory::HTTP_REQUEST_DETECTOR = 2

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


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