Skip to content

Commit 0f0c893

Browse files
Update translation.rst
1 parent 185af22 commit 0f0c893

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

translation.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ The ``trans`` filter can be used to translate *variable texts* and complex expre
403403
{{ message|trans|raw }}
404404
{{ '<h3>bar</h3>'|trans|raw }}
405405
406+
.. tip::
407+
408+
When a number is provided as a parameter named "%count%", the message is parsed for plural
409+
forms and a translation is chosen according to this number using the following rules:
410+
411+
.. code-block:: twig
412+
413+
{{ message|trans({'%name%': 'Fabien', '%count%' => 1}, 'app') }}
414+
406415
.. tip::
407416

408417
You can set the translation domain for an entire Twig template with a single tag:

0 commit comments

Comments
 (0)