Skip to content

[Translation] Document ICU MessageFormat #11523

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 6 commits into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Removed further usage of transchoice in the docs
  • Loading branch information
wouterj committed May 4, 2019
commit 2bd7f86bd1e89e08f58f8b5714c44ee28d4e2b87
12 changes: 12 additions & 0 deletions reference/twig_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@ Translates the text into the current language. More information in
transchoice
~~~~~~~~~~~

.. deprecated:: 4.2

The ``transchoice`` filter is deprecated since Symfony 4.2 and will be
removed in 5.0. Use the :doc:`ICU MessageFormat </translation/message_format>` with
the ``trans`` filter instead.

.. code-block:: twig

{{ message|transchoice(count, arguments = [], domain = null, locale = null) }}
Expand Down Expand Up @@ -588,6 +594,12 @@ Renders the translation of the content. More information in :ref:`translation-ta
transchoice
~~~~~~~~~~~

.. deprecated:: 4.2

The ``transchoice`` tag is deprecated since Symfony 4.2 and will be
removed in 5.0. Use the :doc:`ICU MessageFormat </translation/message_format>` with
the ``trans`` tag instead.

.. code-block:: twig

{% transchoice count with vars from domain into locale %}{% endtranschoice %}
Expand Down
6 changes: 1 addition & 5 deletions translation/debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ command helps you to find these missing or unused translation messages templates

.. code-block:: twig

{# messages can be found when using the trans/transchoice filters and tags #}
{# messages can be found when using the trans filter and tag #}
{% trans %}Symfony is great{% endtrans %}

{{ 'Symfony is great'|trans }}

{{ 'Symfony is great'|transchoice(1) }}

{% transchoice 1 %}Symfony is great{% endtranschoice %}

.. caution::

The extractors can't find messages translated outside templates, like form
Expand Down
12 changes: 12 additions & 0 deletions translation/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ The ``transchoice`` tag automatically gets the ``%count%`` variable from
the current context and passes it to the translator. This mechanism only
works when you use a placeholder following the ``%var%`` pattern.

.. deprecated:: 4.2

The ``transchoice`` tag is deprecated since Symfony 4.2 and will be
removed in 5.0. Use the :doc:`ICU MessageFormat </translation/message_format>` with
the ``trans`` tag instead.

.. caution::

The ``%var%`` notation of placeholders is required when translating in
Expand Down Expand Up @@ -64,6 +70,12 @@ texts* and complex expressions:

{{ message|transchoice(5, {'%name%': 'Fabien'}, 'app') }}

.. deprecated:: 4.2

The ``transchoice`` filter is deprecated since Symfony 4.2 and will be
removed in 5.0. Use the :doc:`ICU MessageFormat </translation/message_format>` with
the ``trans`` filter instead.

.. tip::

Using the translation tags or filters have the same effect, but with
Expand Down