bug #10995 [TwigBridge][Trans]set %count% only on transChoice from the current context. (aitboudad)

This PR was merged into the 2.3 branch.

Discussion
----------

[TwigBridge][Trans]set %count% only on transChoice from the current context.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8408
| License       | MIT

Commits
-------

d176ffc [TwigBridge][Trans]set %count% only on transChoice
This commit is contained in:
Fabien Potencier 2014-05-26 16:50:09 +02:00
commit 168174af08

View File

@ -98,7 +98,7 @@ class TransNode extends \Twig_Node
foreach ($matches[1] as $var) {
$key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getLine());
if (!$vars->hasElement($key)) {
if ('count' === $var) {
if ('count' === $var && null !== $this->getNode('count')) {
$vars->addElement($this->getNode('count'), $key);
} else {
$varExpr = new \Twig_Node_Expression_Name($var, $body->getLine());