From: Fabien Potencier Date: Thu, 12 Aug 2010 20:22:56 +0000 (+0200) Subject: fixed trans tag when no vars are used in plural form (closes #98) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=2595e7b320391488157e8f41d767f45f89ede8dc;p=web%2Fkonrad%2Ftwig.git fixed trans tag when no vars are used in plural form (closes #98) --- diff --git a/CHANGELOG b/CHANGELOG index 8410b1b..e7d8cee 100644 --- 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) diff --git a/lib/Twig/Node/Trans.php b/lib/Twig/Node/Trans.php index 637b127..6a45f93 100644 --- a/lib/Twig/Node/Trans.php +++ b/lib/Twig/Node/Trans.php @@ -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(');'); } }