public function generate($name, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
    {
        if ('_slug' === $name) {
            if ($this->isMultiLanguage() && $this->isMultiDomainHost()) {
                $locale = isset($parameters['_locale']) ? $parameters['_locale'] : $this->getRequestLocale();

                $reverseLocaleMap = $this->getReverseLocaleMap();
                if (isset($reverseLocaleMap[$locale])) {
                    $parameters['_locale'] = $reverseLocaleMap[$locale];
                }
            }
        }

        if (isset($parameters['otherSite'])) {
            $this->otherSite = $this->domainConfiguration->getFullHostById($parameters['otherSite']);
        } else {
            $this->otherSite = null;
        }

        $this->urlGenerator = new UrlGenerator(
            $this->getRouteCollection(),
            $this->getContext()
        );

        if (isset($parameters['otherSite'])) {
            unset($parameters['otherSite']);
        }

        return $this->urlGenerator->generate($name, $parameters, $referenceType);
    }