@@ -613,6 +613,8 @@ Convert Slack short codes to emojis with the ``slack-emoji`` locale::
613
613
$transliterator->transliterate('Menus with :green_salad: or :falafel:');
614
614
// => 'Menus with 🥗 or 🧆'
615
615
616
+ .. _string-text-emoji :
617
+
616
618
Universal Emoji Short Codes Transliteration
617
619
###########################################
618
620
@@ -637,6 +639,33 @@ You can convert emojis to short codes with the ``emoji-text`` locale::
637
639
$transliterator->transliterate('Breakfast with 🥝 or 🥛');
638
640
// => 'Breakfast with :kiwifruit: or :milk-glass:
639
641
642
+ Inverse Emoji Transliteration
643
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
644
+
645
+ .. versionadded :: 7.1
646
+
647
+ The inverse emoji transliteration was introduced in Symfony 7.1.
648
+
649
+ Given the textual representation of an emoji, you can reverse it back to get the
650
+ actual emoji thanks to the :ref: `emojify filter <reference-twig-filter-emojify >`:
651
+
652
+ .. code-block :: twig
653
+
654
+ {{ 'I like :kiwi-fruit:'|emojify }} {# renders: I like 🥝 #}
655
+ {{ 'I like :kiwi:'|emojify }} {# renders: I like 🥝 #}
656
+ {{ 'I like :kiwifruit:'|emojify }} {# renders: I like 🥝 #}
657
+
658
+ By default, ``emojify `` uses the :ref: `text catalog <string-text-emoji >`, which
659
+ merges the emoji text codes of all services. If you prefer, you can select a
660
+ specific catalog to use:
661
+
662
+ .. code-block :: twig
663
+
664
+ {{ 'I :green-heart: this'|emojify }} {# renders: I 💚 this #}
665
+ {{ ':green_salad: is nice'|emojify('slack') }} {# renders: 🥗 is nice #}
666
+ {{ 'My :turtle: has no name yet'|emojify('github') }} {# renders: My 🐢 has no name yet #}
667
+ {{ ':kiwi: is a great fruit'|emojify('gitlab') }} {# renders: 🥝 is a great fruit #}
668
+
640
669
Removing Emojis
641
670
~~~~~~~~~~~~~~~
642
671
0 commit comments