Skip to content

Commit

Permalink
Try author language before
Browse files Browse the repository at this point in the history
Before fallbacking on the backend default language. This fixes issues in the backend mostly
  • Loading branch information
nitriques committed Mar 20, 2016
1 parent ee0b7cb commit 5929c0f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions extension.driver.php
Expand Up @@ -177,14 +177,16 @@ private function _initFLang() {
$region = isset($_REQUEST['fl-region']) ? General::sanitize($_REQUEST['fl-region']) : null;

// set language code
if (false === FLang::setLangCode($language, $region)) {
if (!FLang::setLangCode($language, $region)) {

// try to set language from Admin
if (Symphony::Engine() instanceof Administration) {

// author language is not supported
if (false === FLang::setLangCode(Lang::get())) {
FLang::setLangCode(FLang::getMainLang());
if (class_exists('Administration', false) && Symphony::isLoggedIn()) {
$author = Symphony::Author();
if (!$author || !FLang::setLangCode($author->get('language'))) {
// author language is not supported, use main lang
if (!FLang::setLangCode(FLang::getMainLang())) {
FLang::setLangCode(Lang::get());
}
}
}

Expand Down

0 comments on commit 5929c0f

Please sign in to comment.