Browse Source

fix error, when only one language was selected

master
Dom SP 3 years ago
parent
commit
760a20af84
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      index.php

+ 6
- 2
index.php View File



// set language // set language
$languages = $f3->get('languages'); $languages = $f3->get('languages');
if ( ! is_array($languages) ) {
$languages = [$languages];
}
$f3->set('default_lang', array_shift($languages)); $f3->set('default_lang', array_shift($languages));
if (in_array(strtolower($f3->get('GET.lang')), $languages)) { if (in_array(strtolower($f3->get('GET.lang')), $languages)) {
$f3->set('LANG', strtolower($f3->get('GET.lang')));
$f3->set('LANG', strtolower($f3->get('GET.lang')));
} else { } else {
$f3->set('LANG', $f3->get('default_lang'));
$f3->set('LANG', $f3->get('default_lang'));
} }

// set content dir // set content dir
if(array_key_exists($f3->get('LANG'), $f3->get('content'))) { if(array_key_exists($f3->get('LANG'), $f3->get('content'))) {
$content_dir=$f3->get('content.'.$f3->get('LANG')); $content_dir=$f3->get('content.'.$f3->get('LANG'));

Loading…
Cancel
Save