Skip to content

Commit 353ae26

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: Update translation.rst
2 parents b8555be + 8829154 commit 353ae26

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

translation.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,22 @@ To manage these situations, Symfony follows the `ICU MessageFormat`_ syntax by
297297
using PHP's :phpclass:`MessageFormatter` class. Read more about this in
298298
:doc:`/translation/message_format`.
299299

300+
.. tip::
301+
302+
If you don't use the ICU MessageFormat syntax in your translation files,
303+
pass a parameter named "%count%" to select the best plural form of the message:
304+
305+
.. code-block:: twig
306+
307+
{{ message|trans({'%name%': '...', '%count%' => 1}, 'app') }}
308+
309+
The ``message`` variable must include all the different versions of this
310+
message based on the value of the ``count`` parameter. For example:
311+
312+
.. code-block:: text
313+
314+
{0}%name% has no apples|{1}%name% has one apple|]1,Inf[ %name% has %count% apples
315+
300316
.. _translatable-objects:
301317

302318
Translatable Objects

0 commit comments

Comments
 (0)