Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 73376df

Browse filesBrowse files
kane-menicoujaviereguiluz
authored andcommitted
Remove usages of transChoice() method for Symfony 5.0
1 parent d81297e commit 73376df
Copy full SHA for 73376df

File tree

Expand file treeCollapse file tree

3 files changed

+6
-29
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-29
lines changed

‎components/form.rst

Copy file name to clipboardExpand all lines: components/form.rst
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ Translation
246246
~~~~~~~~~~~
247247

248248
If you're using the Twig integration with one of the default form theme files
249-
(e.g. ``form_div_layout.html.twig``), there are 2 Twig filters (``trans``
250-
and ``transChoice``) that are used for translating form labels, errors, option
249+
(e.g. ``form_div_layout.html.twig``), there is a Twig filter (``trans``)
250+
that is used for translating form labels, errors, option
251251
text and other strings.
252252

253-
To add these Twig filters, you can either use the built-in
253+
To add the ``trans`` Twig filter, you can either use the built-in
254254
:class:`Symfony\\Bridge\\Twig\\Extension\\TranslationExtension` that integrates
255-
with Symfony's Translation component, or add the 2 Twig filters yourself,
255+
with Symfony's Translation component, or add the Twig filter yourself,
256256
via your own Twig extension.
257257

258258
To use the built-in integration, be sure that your project has Symfony's
@@ -281,7 +281,7 @@ to your ``Twig\Environment`` instance::
281281
'en'
282282
);
283283

284-
// adds the TranslationExtension (gives us trans and transChoice filters)
284+
// adds the TranslationExtension (it gives us trans filter)
285285
$twig->addExtension(new TranslationExtension($translator));
286286

287287
$formFactory = Forms::createFormFactoryBuilder()

‎components/translation.rst

Copy file name to clipboardExpand all lines: components/translation.rst
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ To actually translate the message, the Translator uses the following process:
148148
not, the translator returns the original message.
149149

150150
You start this process by calling
151-
:method:`Symfony\\Component\\Translation\\Translator::trans` or
152-
:method:`Symfony\\Component\\Translation\\Translator::transChoice`. Then, the
151+
:method:`Symfony\\Component\\Translation\\Translator::trans`. Then, the
153152
Translator looks for the exact string inside the appropriate message catalog
154153
and returns it (if it exists).
155154

‎components/translation/usage.rst

Copy file name to clipboardExpand all lines: components/translation/usage.rst
-22Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,28 +166,6 @@ use for translation::
166166
'fr_FR'
167167
);
168168

169-
$translator->transChoice(
170-
'{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
171-
10,
172-
[],
173-
'messages',
174-
'fr_FR'
175-
);
176-
177-
.. note::
178-
179-
Starting from Symfony 3.2, the third argument of ``transChoice()`` is
180-
optional when the only placeholder in use is ``%count%``. In previous
181-
Symfony versions you needed to always define it::
182-
183-
$translator->transChoice(
184-
'{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
185-
10,
186-
['%count%' => 10],
187-
'messages',
188-
'fr_FR'
189-
);
190-
191169
.. _retrieving-the-message-catalogue:
192170

193171
Retrieving the Message Catalog

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.