twig hint

symfony has introduced translation at here:
http://symfony.com/doc/current/book/translation.html

a point is if the transchoice is null, you will get an exception like:
Unable to choose a translation
So we need to check if the choice is valid or not before we use this twig tag.


{{ (chart.name~'.short')|trans({}, "charts") }}
如果你想合并string 的话,不要忘了在trans前面加个括号。

如果修改了trans 文件的名字,或者增加了一个tans 文件,需要clear cache, 即便是在dev中

评论

热门博文