脚本宝典收集整理的这篇文章主要介绍了php – Twigjs和动态翻译,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
在TransFilterCompilertest.PHP / testCompileDynamicTranslations中它似乎是一个
{{‘foo’|在我的树枝模板中转换}}
将在twigjs模板中替换
‘this.env_.filter(“trans”,’…在我的twigjs中
但在我编译的js中我只有sb.apPEnd(twig.filter.escape(this.env_,“posted”,“htML”,null,true));
你知道为什么吗?
谢谢!
使用deps文件…
[assetic] git=http://github.COM/kriswallsmith/assetic.git [AsseticBundle] git=http://github.com/symfony/AsseticBundle.git target=/bundles/Symfony/Bundle/AsseticBundle
必须将站点支持的语言指定为参数.我将它添加到我的config.yml文件中.
parameters: assetic.VARiables: locale: ['en','fr']
{% javascripts vars=["locale"] '@AcmeBundle/Resources/views/Default/some_template.html.twig' filter="twig_js" %}
以下是完整性的示例模板:
{% twig_js name="some_template" %} <b>{{'test.say.hello' | trans({"%name%": name|default("World")})}}</b>
还必须在模板定义之前加载twig.js引导程序文件.调用模板符合预期:
Twig.render(some_template,{name: 'CoBaLt2760'})
以上是脚本宝典为你收集整理的php – Twigjs和动态翻译全部内容,希望文章能够帮你解决php – Twigjs和动态翻译所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。