fixed trans tag when no vars are used in plural form (closes #98)
authorFabien Potencier <fabien.potencier@gmail.com>
Thu, 12 Aug 2010 20:22:56 +0000 (22:22 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Thu, 12 Aug 2010 20:22:56 +0000 (22:22 +0200)
CHANGELOG
lib/Twig/Node/Trans.php

index 8410b1b..e7d8cee 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,8 @@
 Backward incompatibilities:
  * the self special variable has been renamed to _self
 
+ * fixed trans tag when no vars are used in plural form
+ * fixed race condition when writing template cache
  * fixed inheritance
  * added the special _context variable to reference the current context
  * renamed self to _self (to avoid conflict)
index 637b127..6a45f93 100644 (file)
@@ -83,8 +83,19 @@ class Twig_Node_Trans extends Twig_Node
             $compiler
                 ->write('echo '.$function.'(')
                 ->subcompile($msg)
-                ->raw(");\n")
             ;
+
+            if (null !== $this->plural) {
+                $compiler
+                    ->raw(', ')
+                    ->subcompile($msg1)
+                    ->raw(', abs(')
+                    ->subcompile($this->count)
+                    ->raw(')')
+                ;
+            }
+
+            $compiler->raw(');');
         }
     }