From 2595e7b320391488157e8f41d767f45f89ede8dc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Aug 2010 22:22:56 +0200 Subject: [PATCH] fixed trans tag when no vars are used in plural form (closes #98) --- CHANGELOG | 2 ++ lib/Twig/Node/Trans.php | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletions(-) 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(');'); } } -- 1.7.2.5