问题描述
我将 Symfony 2.3 与 Sonata Admin Bundle 一起使用.我知道我可以通过这种方式翻译标签:
I'm using Symfony 2.3 with Sonata Admin Bundle.I know that I can translate a label in this way:
->add('shortDescription', null, array('label'=>'shortDescriptionTranslated'))
但这仅适用于configureFormFields"方法,不适用于 dataGrid 和 listFields.
But this is possible only with "configureFormFields" method, not for dataGrid and listFields.
您能否提供一个完整的示例以全局方式翻译标签?我看过这里(Sonata Admin Bundle 中的标签)但我有不知道在 xliff 文件中写什么.
Can you provide me a complete example for translating labels in global way?I have looked here (Labels in Sonata Admin Bundle) but I have no idea what to write in the xliff file.
谢谢!
推荐答案
您是否查看了 Sonata 项目网站上的翻译文档:http://www.sonata-project.org/bundles/admin/master/doc/reference/translation.html ?
Did you review the translation documentation from the Sonata Project website: http://www.sonata-project.org/bundles/admin/master/doc/reference/translation.html ?
您可以为每个管理员设置一个全局目录,默认为消息".取决于翻译策略,源密钥会有所不同,您可以使用 xliff 或 yaml 文件将相关标签翻译为来自 Symfony 框架的任何其他翻译.
You can set a global catalogue per Admin, the default one will be 'messages'. Depends on the translation strategy the source key will be different, one you get the key you can translate the related label as any other translation from the Symfony Framework by using xliff or yaml files.
这篇关于如何在 Sonata Admin Bundle 中翻译标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!