Ignore:
Timestamp:
May 8, 2019, 7:59:39 PM (5 years ago)
Author:
chronos
Message:
  • Fixed: Missing intialization of some variables.
  • Fixed: Missing appmodule dependencies.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/System.php

    r839 r858  
    141141  {
    142142    global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type,
    143       $DatabaseRevision, $Config;
     143      $DatabaseRevision, $Config, $GlobalLocaleManager;
    144144
    145145    date_default_timezone_set('Europe/Prague');
     
    171171      //$Output .= 'Nelze se připojit k databázi.';
    172172    }
     173
     174    $this->LocaleManager = new LocaleManager($this);
     175    $this->LocaleManager->Dir = dirname(dirname(__FILE__)).'/locale';
     176    $this->LocaleManager->Available = array(
     177      'cs' => array('Code' => 'cs', 'Title' => 'Česky'),
     178      'en' => array('Code' => 'en', 'Title' => 'English'),
     179    );
     180    $GlobalLocaleManager = $this->LocaleManager;
     181    $this->LinkLocaleExceptions = array('images', 'style', 'files');
     182
    173183    if(isset($this->Config['Web']['RootFolder']))
    174184      $this->RootURLFolder = $this->Config['Web']['RootFolder'];
     
    195205    {
    196206      $this->PathItems = ProcessURL();
     207
     208      // Detect interface locale
     209      if(isset($this->Config['Web']['Locale']))
     210        $this->LocaleManager->DefaultLangCode = $this->Config['Web']['Locale'];
     211      $this->LocaleManager->LangCode = $this->LocaleManager->DefaultLangCode;
     212      if(count($this->PathItems) > 0)
     213      {
     214         $NewLangCode = $this->PathItems[0];
     215         if(array_key_exists($NewLangCode, $this->LocaleManager->Available))
     216         {
     217           array_shift($this->PathItems);
     218           $this->LocaleManager->LangCode = $NewLangCode;
     219         }
     220      }
     221      if(array_key_exists($this->LocaleManager->LangCode, $this->LocaleManager->Available))
     222        $this->LocaleManager->LoadLocale($this->LocaleManager->LangCode);
     223
    197224      $this->ShowPage();
    198225    }
Note: See TracChangeset for help on using the changeset viewer.