Beispiel #1
0
 /**
  * Initializes the backend language.
  * This is for example done in typo3/template.php with lines like these:
  *
  * require (PATH_typo3 . 'sysext/lang/lang.php');
  * $LANG = t3lib_div::makeInstance('language');
  * $LANG->init($BE_USER->uc['lang']);
  *
  * @param	string		The language key (two character string from backend users profile)
  * @param	string		IGNORE. Not used.
  * @return	void
  */
 public function init($lang, $altPath = '')
 {
     // Initialize the conversion object:
     $this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
     $this->charSetArray = $this->csConvObj->charSetArray;
     // Internally setting the list of TYPO3 backend languages.
     $this->langSplit = TYPO3_languages;
     // Finding the requested language in this list based
     // on the $lang key being inputted to this function.
     $ls = explode('|', $this->langSplit);
     foreach ($ls as $i => $v) {
         // Language is found. Configure it:
         if ($v == $lang) {
             // The index of the language as found in the TYPO3_languages list
             $this->langSplitIndex = $i;
             // The current language key
             $this->lang = $lang;
             // The help URL if different from the default.
             if ($this->helpUrlArray[$this->lang]) {
                 $this->typo3_help_url = $this->helpUrlArray[$this->lang];
             }
             if ($this->charSetArray[$this->lang]) {
                 // The charset if different from the default.
                 $this->charSet = $this->charSetArray[$this->lang];
             }
         }
     }
     // If a forced charset is used and different from the charset otherwise used:
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] != $this->charSet) {
         // Set the forced charset:
         $this->charSet = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
         if ($this->charSet != 'utf-8' && !$this->csConvObj->initCharset($this->charSet)) {
             throw new RuntimeException('Forced charset not found: The forced character set "' . $this->charSet . '" was not found in t3lib/csconvtbl/');
         }
     }
 }