[TwigBundle] added the trans filter

This commit is contained in:
Fabien Potencier 2010-10-01 22:15:09 +02:00
parent 68bff2d214
commit 8e654e8f9e
1 changed files with 15 additions and 0 deletions

View File

@ -33,6 +33,16 @@ class TransExtension extends \Twig_Extension
return $this->translator;
}
/**
* {@inheritdoc}
*/
public function getFilters()
{
return array(
'trans' => new \Twig_Filter_Method($this, 'trans'),
);
}
/**
* Returns the token parser instance to add to the existing list.
*
@ -51,6 +61,11 @@ class TransExtension extends \Twig_Extension
);
}
public function trans($message, array $arguments = array(), $domain = "messages")
{
return $this->translator->trans($message, $arguments, $domain);
}
/**
* Returns the name of the extension.
*