@@ -32,7 +32,7 @@ to compress the internal Symfony emoji data files using the PHP ``zlib`` extensi
3232 .. _emoji-transliteration :
3333
3434Emoji Transliteration
35- ~~~~~~~~~~~~~~~~~~~~~
35+ ---------------------
3636
3737The ``EmojiTransliterator `` class offers a way to translate emojis into their
3838textual representation in all languages based on the `Unicode CLDR dataset `_::
@@ -49,11 +49,13 @@ textual representation in all languages based on the `Unicode CLDR dataset`_::
4949 $transliterator->transliterate('Menus with 🍕 or 🍝');
5050 // => 'Menus with піца or спагеті'
5151
52- You can also combine the ``EmojiTransliterator `` with the :ref: `slugger <string-slugger-emoji >`
53- to transform any emojis into their textual representation.
52+ .. tip ::
53+
54+ When using the :ref: `slugger <string-slugger >` from the String component,
55+ you can combine it with the ``EmojiTransliterator `` to :ref: `slugify emojis <string-slugger-emoji >`.
5456
5557Transliterating Emoji Text Short Codes
56- ......................................
58+ --------------------------------------
5759
5860Services like GitHub and Slack allows to include emojis in your messages using
5961text short codes (e.g. you can add the ``:+1: `` code to render the 👍 emoji).
@@ -62,6 +64,9 @@ Symfony also provides a feature to transliterate emojis into short codes and vic
6264versa. The short codes are slightly different on each service, so you must pass
6365the name of the service as an argument when creating the transliterator.
6466
67+ GitHub Emoji Short Codes Transliteration
68+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
6570Convert emojis to GitHub short codes with the ``emoji-github `` locale::
6671
6772 $transliterator = EmojiTransliterator::create('emoji-github');
@@ -74,15 +79,40 @@ Convert GitHub short codes to emojis with the ``github-emoji`` locale::
7479 $transliterator->transliterate('Teenage :turtle: really love :pizza:');
7580 // => 'Teenage 🐢 really love 🍕'
7681
77- .. note ::
82+ Gitlab Emoji Short Codes Transliteration
83+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84+
85+ Convert emojis to Gitlab short codes with the ``emoji-gitlab `` locale::
86+
87+ $transliterator = EmojiTransliterator::create('emoji-gitlab');
88+ $transliterator->transliterate('Breakfast with 🥝 or 🥛');
89+ // => 'Breakfast with :kiwi: or :milk:'
90+
91+ Convert Gitlab short codes to emojis with the ``gitlab-emoji `` locale::
92+
93+ $transliterator = EmojiTransliterator::create('gitlab-emoji');
94+ $transliterator->transliterate('Breakfast with :kiwi: or :milk:');
95+ // => 'Breakfast with 🥝 or 🥛'
96+
97+ Slack Emoji Short Codes Transliteration
98+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99+
100+ Convert emojis to Slack short codes with the ``emoji-slack `` locale::
101+
102+ $transliterator = EmojiTransliterator::create('emoji-slack');
103+ $transliterator->transliterate('Menus with 🥗 or 🧆');
104+ // => 'Menus with :green_salad: or :falafel:'
105+
106+ Convert Slack short codes to emojis with the ``slack-emoji `` locale::
78107
79- Github, Gitlab and Slack are currently available services in
80- ``EmojiTransliterator ``.
108+ $transliterator = EmojiTransliterator::create('slack-emoji');
109+ $transliterator->transliterate('Menus with :green_salad: or :falafel:');
110+ // => 'Menus with 🥗 or 🧆'
81111
82112.. _text-emoji :
83113
84114Universal Emoji Short Codes Transliteration
85- ###########################################
115+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86116
87117If you don't know which service was used to generate the short codes, you can use
88118the ``text-emoji `` locale, which combines all codes from all services::
@@ -106,7 +136,7 @@ You can convert emojis to short codes with the ``emoji-text`` locale::
106136 // => 'Breakfast with :kiwifruit: or :milk-glass:
107137
108138Inverse Emoji Transliteration
109- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139+ -----------------------------
110140
111141Given the textual representation of an emoji, you can reverse it back to get the
112142actual emoji thanks to the :ref: `emojify filter <reference-twig-filter-emojify >`:
@@ -129,7 +159,7 @@ specific catalog to use:
129159 {{ ':kiwi: is a great fruit'|emojify('gitlab') }} {# renders: 🥝 is a great fruit #}
130160
131161 Removing Emojis
132- ~~~~~~~~~~~~~~~
162+ ---------------
133163
134164The ``EmojiTransliterator `` can also be used to remove all emojis from a string,
135165via the special ``strip `` locale::
0 commit comments