Symfony 'trans' domain inside Twig template

Misiur picture Misiur · Oct 7, 2011 · Viewed 30k times · Source

I'd like to do this:

$this->get('translator')->trans('notice.unregistered', array(), 'index');

Inside Twig template, so I don't have to pass this as an argument. How?

Answer

krishna picture krishna · May 3, 2012

You can also do using trans filter :

{{ 'translationkey'|trans({},'domain') }}