English 中文(简体)
Symfony2 和 Twig : 对所有翻译应用全局过滤器
原标题:Symfony2 and Twig : apply global filter to all translations
  • 时间:2012-05-25 14:16:03
  •  标签:
  • symfony
  • twig

我希望所有翻译文本总是使用 nl2br 过滤器。

我现在的代码是:

{% filter nl2br %}
    {% trans %}my_text_to_translate{% endtrans %}
{% endfilter %}

我想只写这篇:

{% trans %}my_text_to_translate{% endtrans %}

: 我如何在全球范围启用 nl2br 过滤?

非常感谢你的回答:-)

欧莱尔

最佳回答

在一个行中使用此简单的语法 :

或为 twig < a href=" http://twig.sensiolabs.org/doc/advanced.html" rel=“no follow” >http://twig.sensiolabs.org/doc/advanced.html 创建扩展

问题回答

暂无回答




相关问题
Symfony 5, I can t start the server

I develop a symfony project and everything was fine. But since yesterday I can not launch the server: enter image description here The commands symfony server:start and symfony server:stop don t work ...

learning symfony 1.4 will be good when using symfony 2.0?

I know that the architecture is different in symfony 2.0 but im learning 1.4 right now. I wonder if this knowledge i gain about 1.4 will be usable for 2.0 in some extent or will it be a total waste ...

Is symfony 2.0 stable enough to use? [closed]

I wonder if Symfony 2.0 is stable enough to use? Because I ve never used Symfony before. It seems that Symfony 2 is much better than the previous version and I don t want to relearn/recode ...

your experience using symfony 2.0 [closed]

I m going to start a new project that s building web apps from scratch. I have been thinking about using symfony framework for this project. Should I start using symfony 2.0 or stick with 1.4 ? I ...

How to increase the session timeout in Symfony

I would like to know how to increase the session timeout in symfony. Is it enough to only adjust the symfony configuration settings or must I also configure anything in my php.ini file?

How stable or unstable is symfony 2.0? [closed]

Well, I know it s a preview, and I know it says that it s not yet ready for production, and yet I dare ask the question. I need to start building a pretty big application, which is planned to go live ...

热门标签