diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php index 8b6dfa9e605d..6dc59f821f71 100644 --- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php @@ -70,7 +70,7 @@ public function trans($message, array $arguments = array(), $domain = "messages" public function transchoice($message, $count, array $arguments = array(), $domain = "messages") { - return $this->translator->transChoice($message, $count, $arguments, $domain); + return $this->translator->transChoice($message, $count, array_merge(array('%count%' => $count), $arguments), $domain); } /** diff --git a/tests/Symfony/Tests/Bridge/Twig/Extension/TranslationExtensionTest.php b/tests/Symfony/Tests/Bridge/Twig/Extension/TranslationExtensionTest.php index a3b6cb7df294..cf21647b2c08 100644 --- a/tests/Symfony/Tests/Bridge/Twig/Extension/TranslationExtensionTest.php +++ b/tests/Symfony/Tests/Bridge/Twig/Extension/TranslationExtensionTest.php @@ -84,8 +84,8 @@ public function getTransTests() array('{% set vars = { \'%name%\': \'Symfony2\' } %}{{ hello|trans(vars) }}', 'Hello Symfony2', array('hello' => 'Hello %name%')), // transchoice filter - array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|transchoice(count, {\'%count%\': count}) }}', 'There is 5 apples', array('count' => 5)), - array('{{ text|transchoice(5, {\'%count%\': 5, \'%name%\': \'Symfony2\'}) }}', 'There is 5 apples (Symfony2)', array('text' => '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%)')), + array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|transchoice(count) }}', 'There is 5 apples', array('count' => 5)), + array('{{ text|transchoice(5, {\'%name%\': \'Symfony2\'}) }}', 'There is 5 apples (Symfony2)', array('text' => '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%)')), ); }