src/Framework/Routing/RouteGenerator/I18nRouteGenerator.php
protected function localizeCollectionLocaleParameter($prefix, RouteCollection $collection)
    {
        $localizedPrefixes = array();
        foreach ($collection->all() as $name => $route) {
            $locale = $route->getDefault(self::LOCALE_PARAM);
            if ($locale === null) {
                // No locale so nothing to do
                $routePrefix = $prefix;
            } else {
                // A locale was found so localize the prefix
                if (!isset($localizedPrefixes[$locale])) {
                    $localizedPrefixes[$locale] = preg_replace(static::LOCALE_REGEX, $locale, $prefix);
                }
                $routePrefix = $localizedPrefixes[$locale];
            }
            $route->setPath('/' . $routePrefix . $route->getPath());
        }
    }
protected function localizeCollectionLocaleParameter($prefix, RouteCollection $collection)
    {
        $localizedPrefixes = array();
        foreach ($collection->all() as $name => $route) {
            $locale = $route->getDefault(self::LOCALE_PARAM);
            if ($locale === null) {
                // No locale so nothing to do
                $routePrefix = $prefix;
            } else {
                // A locale was found so localize the prefix
                if (!isset($localizedPrefixes[$locale])) {
                    $localizedPrefixes[$locale] = preg_replace(static::LOCALE_REGEX, $locale, $prefix);
                }
                $routePrefix = $localizedPrefixes[$locale];
            }
            $route->setPath('/' . $routePrefix . $route->getPath());
        }
    }
protected function localizeCollectionLocaleParameter ( $ prefix , RouteCollection $ collection ) { $ localizedPrefixes = array ( ) ; foreach ( $ collection -> all ( ) as $ name => $ route ) { $ locale = $ route -> getDefault ( self :: LOCALE_PARAM ) ; if ( $ locale === null ) { // No locale so nothing to do $ routePrefix = $ prefix ; } else { // A locale was found so localize the prefix if ( ! isset ( $ localizedPrefixes [ $ locale ] ) ) { $ localizedPrefixes [ $ locale ] = preg_replace ( static :: LOCALE_REGEX , $ locale , $ prefix ) ; } $ routePrefix = $ localizedPrefixes [ $ locale ] ; } $ route -> setPath ( '/' . $ routePrefix . $ route -> getPath ( ) ) ; } }
Localize the prefix `_locale` of all routes.

@param string $prefix A prefix containing _locale
@param RouteCollection $collection A RouteCollection instance
Localize the prefix _locale of all routes .