Skip to content

Commit

Permalink
Merge pull request #60 from alexantr/master
Browse files Browse the repository at this point in the history
Do not use prefix for default language.
  • Loading branch information
mikehaertl committed Feb 25, 2016
2 parents cfdb9b6 + d384f11 commit 40862f9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion UrlManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function init()
}
}
$this->_defaultLanguage = Yii::$app->language;
return parent::init();
parent::init();
}

/**
Expand Down Expand Up @@ -201,6 +201,15 @@ public function createUrl($params)
$languageRequired = false;
}

// Do not use prefix for default language to prevent unnecessary redirect
if ($languageRequired
&& $language === $this->getDefaultLanguage()
&& !$this->enableDefaultLanguageUrlCode
&& !$this->enableLanguagePersistence
) {
$languageRequired = false;
}

$url = parent::createUrl($params);

// Unless a language was explicitely specified in the parameters we can return a URL without any prefix
Expand Down

0 comments on commit 40862f9

Please sign in to comment.