I started working on a project using Silex and Twig and now I'm trying to set up translations. I registered TranslationServiceProvider before TwigServiceProvider and basically this work's:
{{ app.translator.trans('Homepage') }}
but this doesn't:
{{ 'Homepage'|trans }}
and it returns the following error:
Twig_Error_Syntax in ExpressionParser.php line 573: The filter "trans" does not exist in "homepage.twig" at line 6
I have read the Silex documentation stating that
when using the Twig bridge provided by Symfony (see TwigServiceProvider), you will be allowed to translate strings in the Twig way
but I still don't understand what I am doing wrong and how does the trans filter work.