Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Emoji][Twig] Addemojify filter#19773

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:7.1fromjaviereguiluz:fix_19756
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
31 changes: 31 additions & 0 deletionsreference/twig_reference.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -645,6 +645,37 @@ serialize
Accepts any data that can be serialized by the :doc:`Serializer component </serializer>`
and returns a serialized string in the specified ``format``.

.. _reference-twig-filter-emojify:

emojify
~~~~~~~

.. versionadded:: 7.1

The ``emojify`` filter was introduced in Symfony 7.1.

.. code-block:: twig

{{ text|emojify(catalog = null) }}

``text``
**type**: ``string``

``catalog`` *(optional)*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

When is null, default extension catalog is applied. It's "text" by default in construct.

I don't remember what is text behavior, but we should discribe this default ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

text locale must be documented first#19745

javiereguiluz reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I created#19919

javiereguiluz reacted with heart emoji
**type**: ``string`` | ``null``

The emoji set used to generate the textual representation (``slack``,
``github``, ``gitlab``, etc.)

It transforms the textual representation of an emoji (e.g. ``:wave:``) into the
actual emoji (👋):

.. code-block:: twig

{{ ':+1:'|emojify }} {# renders: 👍 #}
{{ ':+1:'|emojify('github') }} {# renders: 👍 #}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What is the rendering of an unknown value for the catalog ?

Adding an example could be great !

{{ ':thumbsup:'|emojify('gitlab') }} {# renders: 👍 #}

.. _reference-twig-tags:

Tags
Expand Down
29 changes: 29 additions & 0 deletionsstring.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -613,6 +613,8 @@ Convert Slack short codes to emojis with the ``slack-emoji`` locale::
$transliterator->transliterate('Menus with :green_salad: or :falafel:');
// => 'Menus with 🥗 or 🧆'

.. _string-text-emoji:

Universal Emoji Short Codes Transliteration
###########################################

Expand All@@ -637,6 +639,33 @@ You can convert emojis to short codes with the ``emoji-text`` locale::
$transliterator->transliterate('Breakfast with 🥝 or 🥛');
// => 'Breakfast with :kiwifruit: or :milk-glass:

Inverse Emoji Transliteration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 7.1

The inverse emoji transliteration was introduced in Symfony 7.1.

Given the textual representation of an emoji, you can reverse it back to get the
actual emoji thanks to the :ref:`emojify filter <reference-twig-filter-emojify>`:

.. code-block:: twig

{{ 'I like :kiwi-fruit:'|emojify }} {# renders: I like 🥝 #}
{{ 'I like :kiwi:'|emojify }} {# renders: I like 🥝 #}
{{ 'I like :kiwifruit:'|emojify }} {# renders: I like 🥝 #}

By default, ``emojify`` uses the :ref:`text catalog <string-text-emoji>`, which
merges the emoji text codes of all services. If you prefer, you can select a
specific catalog to use:

.. code-block:: twig

{{ 'I :green-heart: this'|emojify }} {# renders: I 💚 this #}
{{ ':green_salad: is nice'|emojify('slack') }} {# renders: 🥗 is nice #}
{{ 'My :turtle: has no name yet'|emojify('github') }} {# renders: My 🐢 has no name yet #}
{{ ':kiwi: is a great fruit'|emojify('gitlab') }} {# renders: 🥝 is a great fruit #}

Removing Emojis
~~~~~~~~~~~~~~~

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp