Closed bjornpost closed 8 years ago
Yes, {% trans with {'%name%': 'Fabien'}
is not part of twig, but symfony/twig-bridge. You will need to load TranslationExtension.
But that extension is loaded by default, according to the source?
Hehum...in deed...
TransTokenParser does this magic, and it should be loaded by this extension...
Would you mind re-opening this issue? I will look into this. Maybe it's something that's changed between 2.7 and 3.0 (I'm testing on a local fork which updated the deps to symfony/* ~3.0
).
Ok, what I've discovered:
TranslationExtension::getFilters()
is calledTranslationExtension::getTokenParsers()
is calledTransTokenParser::parse()
or TransDefaultDomainTokenParser::parse()
are never called.TranslationExtension::trans()
or TranslationExtension::transchoice()
Seems like it's just a matter of swapping the initialisation of Twig_Extensions_Extension_I18n
and TranslationExtension
. Will prepare PR.
Thanks @bjornpost!
The parsing fails on lines like:
(src)
If I'm rendering the template from my application (Silex 2), there's no issue. Do I need to load an extra Twig extension in Twig-Gettext-Extension?