Skip to content

Commit 806fc48

Browse files
committed
Adds information about Pluralized Translations
1 parent ac55eae commit 806fc48

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

components/translation/usage.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@ use for translation::
168168

169169
.. _retrieving-the-message-catalogue:
170170

171+
Pluralized Translations
172+
-----------------------
173+
174+
Translations can be pluralized using `interval notations`_, the count can be
175+
provided using the `%count%` option::
176+
177+
$translator->trans(
178+
'{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
179+
['%count%' => 10],
180+
'messages',
181+
'fr_FR'
182+
);
183+
184+
The Translator also supports pluralization using the ICU MessageFormat, read
185+
:doc:`/translation/message_format` for more information about using it.
186+
171187
Retrieving the Message Catalog
172188
------------------------------
173189

@@ -248,3 +264,5 @@ code needed to generate the previous XLIFF file::
248264
]);
249265

250266
.. _`L10n`: https://en.wikipedia.org/wiki/Internationalization_and_localization
267+
268+
.. _`interval notations`: https://en.wikipedia.org/wiki/Interval_(mathematics)

0 commit comments

Comments
 (0)