public function getTranslatedRoute(
        $baseUrl, &$parsedUrl, $defaultLocale, LocaleCollection $supportedLocales
    ) {
        if (empty($parsedUrl) || ! isset($parsedUrl['path'])) {
            $parsedUrl['path'] = '';
        }
        else {
            $path = $parsedUrl['path'] = str_replace($baseUrl, '', '/' . ltrim($parsedUrl['path'], '/'));

            foreach ($supportedLocales->keys() as $locale) {
                foreach (["%^/?$locale/%", "%^/?$locale$%"] as $pattern) {
                    $parsedUrl['path'] = preg_replace($pattern, '$1', $parsedUrl['path']);

                    if ($parsedUrl['path'] !== $path) {
                        $defaultLocale = $locale;
                        break 2;
                    }
                }
            }
        }

        $parsedUrl['path'] = ltrim($parsedUrl['path'], '/');

        return $this->findTranslatedRouteByPath($parsedUrl['path'], $defaultLocale);
    }
public function getTranslatedRoute(
        $baseUrl, &$parsedUrl, $defaultLocale, LocaleCollection $supportedLocales
    ) {
        if (empty($parsedUrl) || ! isset($parsedUrl['path'])) {
            $parsedUrl['path'] = '';
        }
        else {
            $path = $parsedUrl['path'] = str_replace($baseUrl, '', '/' . ltrim($parsedUrl['path'], '/'));

            foreach ($supportedLocales->keys() as $locale) {
                foreach (["%^/?$locale/%", "%^/?$locale$%"] as $pattern) {
                    $parsedUrl['path'] = preg_replace($pattern, '$1', $parsedUrl['path']);

                    if ($parsedUrl['path'] !== $path) {
                        $defaultLocale = $locale;
                        break 2;
                    }
                }
            }
        }

        $parsedUrl['path'] = ltrim($parsedUrl['path'], '/');

        return $this->findTranslatedRouteByPath($parsedUrl['path'], $defaultLocale);
    }
public function getTranslatedRoute ( $ baseUrl , & $ parsedUrl , $ defaultLocale , LocaleCollection $ supportedLocales ) { if ( empty ( $ parsedUrl ) || ! isset ( $ parsedUrl [ 'path' ] ) ) { $ parsedUrl [ 'path' ] = '' ; } else { $ path = $ parsedUrl [ 'path' ] = str_replace ( $ baseUrl , '' , '/' . ltrim ( $ parsedUrl [ 'path' ] , '/' ) ) ; foreach ( $ supportedLocales -> keys ( ) as $ locale ) { foreach ( [ "%^/?$locale/%" , "%^/?$locale$%" ] as $ pattern ) { $ parsedUrl [ 'path' ] = preg_replace ( $ pattern , '$1' , $ parsedUrl [ 'path' ] ) ; if ( $ parsedUrl [ 'path' ] !== $ path ) { $ defaultLocale = $ locale ; break 2 ; } } } } $ parsedUrl [ 'path' ] = ltrim ( $ parsedUrl [ 'path' ] , '/' ) ; return $ this -> findTranslatedRouteByPath ( $ parsedUrl [ 'path' ] , $ defaultLocale ) ; }
Get the translated route.

@param  string                                             $baseUrl
@param  array|false                                        $parsedUrl
@param  string                                             $defaultLocale
@param  \Arcanedev\Localization\Entities\LocaleCollection  $supportedLocales

@return string|false
Get the translated route .