Skip to content

Commit f690538

Browse files
committed
[Emoji] Add the gitlab locale
1 parent 309320a commit f690538

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

string.rst

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,11 @@ textual representation in all languages based on the `Unicode CLDR dataset`_::
560560

561561

562562
The ``EmojiTransliterator`` also provides special locales that convert emojis to
563-
short codes and vice versa in specific platforms, such as GitHub and Slack.
563+
short codes and vice versa in specific platforms, such as GitHub, Gitlab and Slack.
564+
565+
.. versionadded:: 7.1
566+
567+
The ``gitlab`` special locale was introduced in Symfony 7.1.
564568

565569
GitHub Emoji Transliteration
566570
............................
@@ -577,6 +581,25 @@ Convert GitHub short codes to emojis with the ``github-emoji`` locale::
577581
$transliterator->transliterate('Teenage :turtle: really love :pizza:');
578582
// => 'Teenage 🐢 really love 🍕'
579583

584+
Gitlab Emoji Transliteration
585+
............................
586+
587+
Convert Gitlab emojis to short codes with the ``emoji-gitlab`` locale::
588+
589+
$transliterator = EmojiTransliterator::create('emoji-gitlab');
590+
$transliterator->transliterate('Breakfast with 🥝 or 🥛');
591+
// => 'Breakfast with :kiwi: or :milk:'
592+
593+
Convert Gitlab short codes to emojis with the ``gitlab-emoji`` locale::
594+
595+
$transliterator = EmojiTransliterator::create('gitlab-emoji');
596+
$transliterator->transliterate('Breakfast with :kiwi: or :milk:');
597+
// => 'Breakfast with 🥝 or 🥛'
598+
599+
.. versionadded:: 7.1
600+
601+
The ``gitlab`` special locale was introduced in Symfony 7.1.
602+
580603
Slack Emoji Transliteration
581604
...........................
582605

@@ -693,7 +716,7 @@ with the slugger to transform any emojis into their textual representation::
693716
// $slug = 'un-chat-qui-sourit-chat-noir-et-un-tete-de-lion-vont-au-parc-national';
694717

695718
If you want to use a specific locale for the emoji, or to use the short codes
696-
from GitHub or Slack, use the first argument of ``withEmoji()`` method::
719+
from GitHub, Gitlab or Slack, use the first argument of ``withEmoji()`` method::
697720

698721
use Symfony\Component\String\Slugger\AsciiSlugger;
699722

@@ -703,6 +726,10 @@ from GitHub or Slack, use the first argument of ``withEmoji()`` method::
703726
$slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁');
704727
// $slug = 'a-smiley-cat-black-cat-and-a-lion';
705728

729+
.. versionadded:: 7.1
730+
731+
The ``gitlab`` special locale was introduced in Symfony 7.1.
732+
706733
.. _string-inflector:
707734

708735
Inflector

0 commit comments

Comments
 (0)