我自己的 twig 扩展中的 i18n
How can I use twigs i18n in my own twig extension?
This is what I have right now: http://pastebin.com/yNhHuC6C but need to use i18n within.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您肯定有这个 twig 扩展的服务定义,例如:
您可以在您的扩展中注入任何其他服务,例如 twig.extension.trans 服务。
xml 变为:
您的 TestPostExtension 类将接收
Symfony\Bridge\Twig\Extension\TranslationExtension
作为其构造函数的第一个参数:You surely have a service definition of this twig extension, something like:
You can inject any other service in your's, like the
twig.extension.trans
service.The xml becomes:
Your TestPostExtension class will then receive a
Symfony\Bridge\Twig\Extension\TranslationExtension
as first argument of its constructor: