8000 Revert "[Transalation] Document range translation using the ICU Messa… · symfony/symfony-docs@b3d5de6 · GitHub
[go: up one dir, main page]

Skip to content

Commit b3d5de6

Browse files
committed
Revert "[Transalation] Document range translation using the ICU MessageFormat"
This reverts commit bcc89a7.
1 parent c3166bd commit b3d5de6

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

translation/message_format.rst

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -267,69 +267,6 @@ Usage of this string is the same as with variables and select::
267267
}
268268
}
269269
270-
Ranges
271-
~~~~~~
272-
273-
Sometimes, it can be handy to use ranges for a translation. The ``intl`` component provides a way to do this, using the ``choice`` function.
274-
275-
.. configuration-block::
276-
277-
.. code-block:: yaml
278-
279-
# translations/messages+intl-icu.en.yaml
280-
balance_account: >-
281-
{balance, choice,
282-
-∞ < Oops! I'm down |
283-
0 < I still have money |
284-
1000 # I have a lot of money !
285-
}
286-
287-
.. code-block:: xml
288-
289-
<!-- translations/messages+intl-icu.en.xlf -->
290-
<?xml version="1.0"?>
291-
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
292-
<file source-language="en" datatype="plaintext" original="file.ext">
293-
<body>
294-
<trans-unit id="balance_account">
295-
<source>balance_account</source>
296-
<target>{balance, choice, -∞ < Oops! I'm down | 0 < I still have money | 1000 # I have a lot of money !}</target>
297-
</trans-unit>
298-
</body>
299-
</file>
300-
</xliff>
301-
302-
.. code-block:: php
303-
304-
// translations/messages+intl-icu.en.php
305-
return [
306-
'balance_account' => '{balance, choice,
307-
-∞ < Oops! I\'m down |
308-
0 < I still have money |
309-
1000 # I have a lot of money!
310-
}',
311-
];
312-
313-
Here are some examples of what this ``choice`` formatter will render::
314-
315-
// prints "Oops! I'm down"
316-
echo $translator->trans('balance_account', ['balance' => -10]);
317-
echo $translator->trans('balance_account', ['balance' => 0]);
318-
319-
// prints "I still have money"
320-
echo $translator->trans('balance_account', ['balance' => 10]);
321-
echo $translator->trans('balance_account', ['balance' => 999]);
322-
323-
// prints "I have a lot of money!"
324-
echo $translator->trans('balance_account', ['balance' => 1000]);
325-
326-
This formatter adds some characters used as keyword:
327-
328-
* Ranges must be separated by a pipe (``|``).
329-
* ``<`` means ``inferior to``.
330-
* ``#`` means ``inferior or equal to``.
331-
* ```` is the infinity symbol (U+221E). It can be prefixed with a minus (``-``).
332-
333270
Additional Placeholder Functions
334271
--------------------------------
335272

0 commit comments

Comments
 (0)
0