You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UPGRADE-5.0.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,8 +114,8 @@ FrameworkBundle
114
114
* The `RequestDataCollector` class has been removed. Use the `Symfony\Component\HttpKernel\DataCollector\RequestDataCollector` class instead.
115
115
* Removed `Symfony\Bundle\FrameworkBundle\Controller\Controller`. Use `Symfony\Bundle\FrameworkBundle\Controller\AbstractController` instead.
116
116
* Added support for the SameSite attribute for session cookies. It is highly recommended to set this setting (`framework.session.cookie_samesite`) to `lax` for increased security against CSRF attacks.
117
-
* The `ContainerAwareCommand` class has been removed, use `Symfony\Component\Console\Command\Command`
118
-
with dependency injection instead.
117
+
* The `ContainerAwareCommand` class has been removed, use `Symfony\Component\Console\Command\Command` with dependency injection instead.
118
+
* The `Templating\Helper\TranslatorHelper::transChoice()` method has been removed, use the `trans()` one instead with a `%count%` parameter.
119
119
120
120
HttpFoundation
121
121
--------------
@@ -184,11 +184,13 @@ Translation
184
184
* The `TranslationWriter::disableBackup()` method has been removed.
185
185
* The `TranslatorInterface` has been removed in favor of `Symfony\Contracts\Translation\TranslatorInterface`
186
186
* The `MessageSelector`, `Interval` and `PluralizationRules` classes have been removed, use `IdentityTranslator` instead
187
+
* The `Translator::transChoice()` method has been removed in favor of using `Translator::trans()` with "%count%" as the parameter driving plurals
187
188
188
189
TwigBundle
189
190
----------
190
191
191
192
* The default value (`false`) of the `twig.strict_variables` configuration option has been changed to `%kernel.debug%`.
193
+
* The `transchoice` tag and filter have been removed, use the `trans` ones instead with a `%count%` parameter.
thrownew \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|trans(count=count) }}', 'There is 5 apples', array('count' => 5)),
140
+
array('{{ text|trans(count=5, arguments={\'%name%\': \'Symfony\'}) }}', 'There is 5 apples (Symfony)', array('text' => '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%)')),
141
+
array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|trans({}, "messages", "fr", count) }}', 'There is 5 apples', array('count' => 5)),
142
+
);
143
+
}
144
+
145
+
/**
146
+
* @group legacy
147
+
*/
148
+
publicfunctiongetTransChoiceTests()
149
+
{
150
+
returnarray(
151
+
// trans tag
152
+
array('{% trans %}Hello{% endtrans %}', 'Hello'),
153
+
array('{% trans %}%name%{% endtrans %}', 'Symfony', array('name' => 'Symfony')),
154
+
155
+
array('{% trans from elsewhere %}Hello{% endtrans %}', 'Hello'),
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@
23
23
* Token Parser for the 'transchoice' tag.
24
24
*
25
25
* @author Fabien Potencier <fabien@symfony.com>
26
+
*
27
+
* @deprecated since Symfony 4.2, use the "trans" tag with a "%count%" parameter instead
26
28
*/
27
29
class TransChoiceTokenParser extends TransTokenParser
28
30
{
@@ -38,6 +40,8 @@ public function parse(Token $token)
38
40
$lineno = $token->getLine();
39
41
$stream = $this->parser->getStream();
40
42
43
+
@trigger_error(sprintf('The "transchoice" tag is deprecated since Symfony 4.2, use the "trans" one instead with a "%count%" parameter in %s line %d.', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED);
0 commit comments