Closed
Description
Symfony version(s) affected
6.2.0
Description
In @sulu we try to add the Slugger with Emoji support. Currently the Slugger will hardly fail when the locale is not found with IntlException
: https://github.com/sulu/sulu/actions/runs/3554459366/jobs/5970575754#step:10:578
How to reproduce
$slugger = new \Symfony\Component\String\Slugger\AsciiSlugger();
$slugger = $slugger->withEmoji();
$slugger->slug('Menus with 🍕 or 🍝', '-', 'de-at');
Possible Solution
Catch exception in fallback to normal slug for not supported locale.
Additional Context
We currently don't know which locales are supported by withEmoji
and which ones not. Which ends up in strange code if we need to handle that ourselves:
try {
$slug = $this->sluggerWithEmojiSupport->slug($part, '-', $languageCode);
} catch (\IntlException $e) {
$slug = $this->sluggerWithoutEmojiSupport->slug($part, '-', $languageCode);
}
/cc @lyrixx What do you think?