Skip to content
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

[String] Add support for emoji in AsciiSlugger #47264

Merged
merged 1 commit into from Aug 17, 2022

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Aug 12, 2022

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

Usage

use Symfony\Component\String\Slugger\AsciiSlugger;

$slugger = new AsciiSlugger();
$slugger = $slugger->withEmoji();

$slugger->slug('a 😺, πŸˆβ€β¬›, and a 🦁 go to 🏞️... 😍 πŸŽ‰ πŸ’›', '-', 'en');
// a-grinning-cat-black-cat-and-a-lion-go-to-national-park-smiling-face-with-heart-eyes-party-popper-yellow-heart

$slugger->slug('un 😺, πŸˆβ€β¬›, et un 🦁 vont au 🏞️');
// un-chat-qui-sourit-chat-noir-et-un-tete-de-lion-vont-au-parc-national

@lyrixx
Copy link
Member Author

lyrixx commented Aug 13, 2022

@welcoMattic Thanks for the review, I addressed your comments

@nicolas-grekas

This comment was marked as resolved.

@lyrixx
Copy link
Member Author

lyrixx commented Aug 16, 2022

Hi, I addressed all comments. Thanks for the review

@ro0NL
Copy link
Contributor

ro0NL commented Aug 17, 2022

Related to #47263, does this mean we need to provision slugger with "en_github/slack" locale? Im not sure it's legit.

@lyrixx
Copy link
Member Author

lyrixx commented Aug 17, 2022

It's not legit IMHO, since the output of the transliterator may contains :

@lyrixx
Copy link
Member Author

lyrixx commented Aug 17, 2022

@nicolas-grekas I addressed your comments

@ro0NL
Copy link
Contributor

ro0NL commented Aug 17, 2022

should we update

public static function create(string $id, int $direction = self::FORWARD): ?\Transliterator
with soft @return to convey it's not a nullable?

@nicolas-grekas
Copy link
Member

We can remove the ? actually. Up for a PR @ro0NL?

@nicolas-grekas
Copy link
Member

(deps=low need a bump for intl in composer.json)

@lyrixx
Copy link
Member Author

lyrixx commented Aug 17, 2022

I fixed requirements for this PR, and also the return type of EmojiTransliterator while I had the code open / cc @ro0NL

nicolas-grekas added a commit that referenced this pull request Aug 17, 2022
…) and some others methods (lyrixx)

This PR was squashed before being merged into the 6.2 branch.

Discussion
----------

[Intl] Fixed return type of EmojiTransliterator::create() and some others methods

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | #47264 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

770d590 [Intl] Fixed return type of EmojiTransliterator::create() and some others methods
@nicolas-grekas
Copy link
Member

Thank you @lyrixx.

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.

None yet

10 participants