Skip to content

[Emoji] Add the gitlab locale #19736

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
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ textual representation in all languages based on the `Unicode CLDR dataset`_::


The ``EmojiTransliterator`` also provides special locales that convert emojis to
short codes and vice versa in specific platforms, such as GitHub and Slack.
short codes and vice versa in specific platforms, such as GitHub, Gitlab and Slack.

GitHub Emoji Transliteration
............................
Expand All @@ -577,6 +577,21 @@ Convert GitHub short codes to emojis with the ``github-emoji`` locale::
$transliterator->transliterate('Teenage :turtle: really love :pizza:');
// => 'Teenage 🐢 really love 🍕'

Gitlab Emoji Transliteration
............................

Convert Gitlab emojis to short codes with the ``emoji-gitlab`` locale::

$transliterator = EmojiTransliterator::create('emoji-gitlab');
$transliterator->transliterate('Breakfast with 🥝 or 🥛');
// => 'Breakfast with :kiwi: or :milk:'

Convert Gitlab short codes to emojis with the ``gitlab-emoji`` locale::

$transliterator = EmojiTransliterator::create('gitlab-emoji');
$transliterator->transliterate('Breakfast with :kiwi: or :milk:');
// => 'Breakfast with 🥝 or 🥛'

Slack Emoji Transliteration
...........................

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

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

use Symfony\Component\String\Slugger\AsciiSlugger;

Expand Down