public function language($code, $path = '', $options = array())
    {
        $segments = $this->getSegments(true, $path);
        $langcode = $this->request->getLangcode();

        if (isset($segments[0]) && $segments[0] === $langcode) {
            unset($segments[0]);
        }

        array_unshift($segments, $code);

        $url = $this->request->base(true) . trim(implode('/', $segments), '/');
        $url = empty($options) ? $url : "$url?" . http_build_query($options);

        return filter_var($url, FILTER_SANITIZE_URL);
    }
public function language($code, $path = '', $options = array())
    {
        $segments = $this->getSegments(true, $path);
        $langcode = $this->request->getLangcode();

        if (isset($segments[0]) && $segments[0] === $langcode) {
            unset($segments[0]);
        }

        array_unshift($segments, $code);

        $url = $this->request->base(true) . trim(implode('/', $segments), '/');
        $url = empty($options) ? $url : "$url?" . http_build_query($options);

        return filter_var($url, FILTER_SANITIZE_URL);
    }
public function language ( $ code , $ path = '' , $ options = array ( ) ) { $ segments = $ this -> getSegments ( true , $ path ) ; $ langcode = $ this -> request -> getLangcode ( ) ; if ( isset ( $ segments [ 0 ] ) && $ segments [ 0 ] === $ langcode ) { unset ( $ segments [ 0 ] ) ; } array_unshift ( $ segments , $ code ) ; $ url = $ this -> request -> base ( true ) . trim ( implode ( '/' , $ segments ) , '/' ) ; $ url = empty ( $ options ) ? $ url : "$url?" . http_build_query ( $ options ) ; return filter_var ( $ url , FILTER_SANITIZE_URL ) ; }
Returns a URL with appended language code
@param string $code
@param string $path
@param array $options
@return string|false
Returns a URL with appended language code