changed trans tag to accept any variable for the plural count
authorFabien Potencier <fabien.potencier@gmail.com>
Sat, 27 Nov 2010 09:10:04 +0000 (10:10 +0100)
committerFabien Potencier <fabien.potencier@gmail.com>
Sat, 27 Nov 2010 09:10:04 +0000 (10:10 +0100)
CHANGELOG
lib/Twig/TokenParser/Trans.php

index ceb28cb..771243a 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,7 @@ Backward incompatibilities:
  * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead)
 
 Changes:
+ * changed trans tag to accept any variable for the plural count
  * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements)
  * added the ** (power) operator
  * changed the algorithm used for parsing expressions
index d542417..2c11d07 100644 (file)
@@ -30,7 +30,7 @@ class Twig_TokenParser_Trans extends Twig_TokenParser
             $stream->expect(Twig_Token::BLOCK_END_TYPE);
             $body = $this->parser->subparse(array($this, 'decideForFork'));
             if ('plural' === $stream->next()->getValue()) {
-                $count = new Twig_Node_Expression_Name($stream->expect(Twig_Token::NAME_TYPE)->getValue(), $lineno);
+                $count = $this->parser->getExpressionParser()->parseExpression();
                 $stream->expect(Twig_Token::BLOCK_END_TYPE);
                 $plural = $this->parser->subparse(array($this, 'decideForEnd'), true);
             }