Skip to content

[String] Fix AsciiSlugger with emojis #48395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2022

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 6.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets #48364
License MIT
Doc PR -

First fix: let's fall back to parent locales if the emoji map does not exist for the full locale? (like we do for symbols map)

Second fix: let's just ignore the emoji transliterator for totally unsupported locales, the behavior of the slugger will just strip the emojis like it already does.

@carsonbot carsonbot added this to the 6.2 milestone Nov 29, 2022
@fancyweb fancyweb force-pushed the string/fix-ascii-slugger-emoji branch from c4b97d7 to 37acb1b Compare November 29, 2022 18:54
$transliterator[] = EmojiTransliterator::create("emoji-{$this->emoji}");
} elseif ($this->emoji && null !== $locale) {
$transliterator[] = EmojiTransliterator::create("emoji-{$locale}");
if ($emojiTransliterator = $this->createEmojiTransliterator(\is_string($this->emoji) ? $this->emoji : ($this->emoji ? $locale : null))) {
Copy link
Member

@lyrixx lyrixx Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would pass the locale only to the fonction. And do some check there.
Ternary are harder to ready and I don't even talk about nested ternary 😁

@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

@nicolas-grekas nicolas-grekas force-pushed the string/fix-ascii-slugger-emoji branch from 2b046ee to 5f320e5 Compare November 30, 2022 17:14
@nicolas-grekas nicolas-grekas merged commit aa79198 into symfony:6.2 Nov 30, 2022
@fabpot fabpot mentioned this pull request Nov 30, 2022
@fancyweb fancyweb deleted the string/fix-ascii-slugger-emoji branch December 2, 2022 09:10
@fabpot fabpot mentioned this pull request Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants