[TwigBundle] added the trans filter
This commit is contained in:
parent
68bff2d214
commit
8e654e8f9e
|
@ -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.
|
||||
*
|
||||
|
|
Reference in New Issue