@@ -9,27 +9,13 @@ Twig Templates
99Using Twig Tags
1010~~~~~~~~~~~~~~~
1111
12- Symfony provides specialized Twig tags ( ``trans `` and `` transchoice ``) to
13- help with message translation of *static blocks of text *:
12+ Symfony provides a specialized Twig tag ``trans `` to help with message
13+ translation of *static blocks of text *:
1414
1515.. code-block :: twig
1616
1717 {% trans %}Hello %name%{% endtrans %}
1818
19- {% transchoice count %}
20- {0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples
21- {% endtranschoice %}
22-
23- The ``transchoice `` tag automatically gets the ``%count% `` variable from
24- the current context and passes it to the translator. This mechanism only
25- works when you use a placeholder following the ``%var% `` pattern.
26-
27- .. deprecated :: 4.2
28-
29- The ``transchoice `` tag is deprecated since Symfony 4.2 and will be
30- removed in 5.0. Use the :doc: `ICU MessageFormat </translation/message_format >` with
31- the ``trans `` tag instead.
32-
3319 .. caution ::
3420
3521 The ``%var% `` notation of placeholders is required when translating in
@@ -48,34 +34,19 @@ You can also specify the message domain and pass some additional variables:
4834
4935 {% trans with {'%name%': 'Fabien'} from 'app' into 'fr' %}Hello %name%{% endtrans %}
5036
51- {% transchoice count with {'%name%': 'Fabien'} from 'app' %}
52- {0} %name%, there are no apples|{1} %name%, there is one apple|]1,Inf[ %name%, there are %count% apples
53- {% endtranschoice %}
54-
5537 .. _translation-filters :
5638
5739Using Twig Filters
5840~~~~~~~~~~~~~~~~~~
5941
60- The ``trans `` and ``transchoice `` filters can be used to translate *variable
61- texts * and complex expressions:
42+ The ``trans `` filter can be used to translate *variable texts * and complex expressions:
6243
6344.. code-block :: twig
6445
6546 {{ message|trans }}
6647
67- {{ message|transchoice(5) }}
68-
6948 {{ message|trans({'%name%': 'Fabien'}, 'app') }}
7049
71- {{ message|transchoice(5, {'%name%': 'Fabien'}, 'app') }}
72-
73- .. deprecated :: 4.2
74-
75- The ``transchoice `` filter is deprecated since Symfony 4.2 and will be
76- removed in 5.0. Use the :doc: `ICU MessageFormat </translation/message_format >` with
77- the ``trans `` filter instead.
78-
7950 .. tip ::
8051
8152 Using the translation tags or filters have the same effect, but with
@@ -116,8 +87,3 @@ The translator service is accessible in PHP templates through the
11687
11788 <?= $view['translator']->trans('Symfony is great') ?>
11889
119- <?= $view['translator']->transChoice(
120- '{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
121- 10,
122- ['%count%' => 10]
123- ) ?>
0 commit comments