public function generateSlug()
    {
        $translator = $this->translator();
        $languages  = $translator->availableLocales();
        $patterns   = $this->slugPattern();
        $curSlug    = $this->slug();
        $newSlug    = [];

        $origLang = $translator->getLocale();
        foreach ($languages as $lang) {
            $pattern = $patterns[$lang];

            $translator->setLocale($lang);
            if ($this->isSlugEditable() && isset($curSlug[$lang]) && strlen($curSlug[$lang])) {
                $newSlug[$lang] = $curSlug[$lang];
            } else {
                $newSlug[$lang] = $this->generateRoutePattern($pattern);
                if (!strlen($newSlug[$lang])) {
                    throw new UnexpectedValueException(sprintf(
                        'The slug is empty; the pattern is "%s"',
                        $pattern
                    ));
                }
            }
        }
        $translator->setLocale($origLang);

        return $translator->translation($newSlug);
    }