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 array URI parameters
|
||||||
|
* @param string $lang a language code
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Kohana_Exception
|
* @throws Kohana_Exception
|
||||||
* @uses Route::REGEX_Key
|
* @uses Route::REGEX_Key
|
||||||
*/
|
*/
|
||||||
public function uri(array $params = NULL)
|
public function uri(array $params = NULL, $lang = NULL)
|
||||||
{
|
{
|
||||||
$uri = parent::uri($params);
|
$uri = parent::uri($params);
|
||||||
|
|
||||||
// We add the language code if required
|
// We add the language code if required
|
||||||
if($this->_lang)
|
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;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue