Skip to content

Commit e349a74

Browse files
committed
minor #15263 [Translation] Update translation.rst (noniagriconomie)
This PR was submitted for the 5.2 branch but it was merged into the 5.3 branch instead. Discussion ---------- [Translation] Update translation.rst Related to https://github.com/symfony/symfony/blob/5.x/src/Symfony/Contracts/Translation/TranslatorInterface.php#L24 I propose to add this here, as not all projects uses ICU translations, so documenting the special `%count%` could be useful Commits ------- b8debc5 Update translation.rst
2 parents 683c628 + b8debc5 commit e349a74

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
@@ -410,6 +410,15 @@ The ``trans`` filter can be used to translate *variable texts* and complex expre
410410
{{ message|trans|raw }}
411411
{{ '<h3>bar</h3>'|trans|raw }}
412412
413+
.. tip::
414+
415+
When a number is provided as a parameter named "%count%", the message is parsed for plural
416+
forms and a translation is chosen according to this number using the following rules:
417+
418+
.. code-block:: twig
419+
420+
{{ message|trans({'%name%': 'Fabien', '%count%' => 1}, 'app') }}
421+
413422
.. tip::
414423

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

0 commit comments

Comments
 (0)