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
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