src/Terranet/Localizer/Resolvers/RequestResolver.php
public function assemble($iso, $url = null)
    {
        $url = rtrim($url, '/');
        $locales = locales()->map->iso6391()->all();
        $default = getDefault()->iso6391();

        foreach ($locales as $locale) {
            # handle urls that contains language in request uri: /en | /en/profile
            # skip urls that starts with string equals with one of locales: /english
            if (starts_with($url, "/{$locale}/") || "/{$locale}" === $url) {
                return url(preg_replace(
                    '~^\/' . $locale . '~si',
                    $iso === $default ? "" : "/{$iso}",
                    $url
                ));
            }
        }

        # prepend url with $iso
        return url(
            ($iso === $default ? "" : $iso . '/') . ltrim($url, '/')
        );
    }
public function assemble($iso, $url = null)
    {
        $url = rtrim($url, '/');
        $locales = locales()->map->iso6391()->all();
        $default = getDefault()->iso6391();

        foreach ($locales as $locale) {
            # handle urls that contains language in request uri: /en | /en/profile
            # skip urls that starts with string equals with one of locales: /english
            if (starts_with($url, "/{$locale}/") || "/{$locale}" === $url) {
                return url(preg_replace(
                    '~^\/' . $locale . '~si',
                    $iso === $default ? "" : "/{$iso}",
                    $url
                ));
            }
        }

        # prepend url with $iso
        return url(
            ($iso === $default ? "" : $iso . '/') . ltrim($url, '/')
        );
    }
public function assemble ( $ iso , $ url = null ) { $ url = rtrim ( $ url , '/' ) ; $ locales = locales ( ) -> map -> iso6391 ( ) -> all ( ) ; $ default = getDefault ( ) -> iso6391 ( ) ; foreach ( $ locales as $ locale ) { # handle urls that contains language in request uri: /en | /en/profile # skip urls that starts with string equals with one of locales: /english if ( starts_with ( $ url , "/{$locale}/" ) || "/{$locale}" === $ url ) { return url ( preg_replace ( '~^\/' . $ locale . '~si' , $ iso === $ default ? "" : "/{$iso}" , $ url ) ) ; } } # prepend url with $iso return url ( ( $ iso === $ default ? "" : $ iso . '/' ) . ltrim ( $ url , '/' ) ) ; }
Re-Assemble current url with different locale.

@param $iso
@param null $url
@return mixed
Re - Assemble current url with different locale .