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);
    }