mirror of
https://github.com/Oreolek/kohana-multilang.git
synced 2024-04-25 21:59:29 +03:00
Fixed an issue with routes having the same pattern and a different language.
This commit is contained in:
parent
bce79d53a8
commit
752128582d
|
@ -137,18 +137,21 @@ class Multilang_Route extends Kohana_Route {
|
|||
* ));
|
||||
*
|
||||
* @param array URI parameters
|
||||
* @param string $lang a language code
|
||||
* @return string
|
||||
* @throws Kohana_Exception
|
||||
* @uses Route::REGEX_Key
|
||||
*/
|
||||
public function uri(array $params = NULL)
|
||||
public function uri(array $params = NULL, $lang = NULL)
|
||||
{
|
||||
$uri = parent::uri($params);
|
||||
|
||||
// We add the language code if required
|
||||
if($this->_lang)
|
||||
{
|
||||
return $this->_lang.'/'.$uri;
|
||||
// We dont use the route language to avoid some issues with routes of different languages having the same pattern
|
||||
$lang = ($lang === NULL ? Request::$lang : $lang);
|
||||
return $lang.'/'.$uri;
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue