简体   繁体   English

Sonata Admin翻译无法翻译翻译数组

[英]Sonata Admin translation does not translate translation array

I am having a translation array in Sonata Admin that looks like this: 我在Sonata Admin中有一个转换数组,如下所示:

messages.en.yml messages.en.yml

admin:
    form:
        label:
            identifier:
                identificationTitle: Some text here
                otherKey: blabla

when I am trying to access it like this 当我试图像这样访问它时

{{ 'admin.form.label.identifier.identificationTitle'|trans }}

or like this 或像这样

{{ 'admin.form.label.identifier.identificationTitle'|trans({}, 'MyBundle') }}

they don't work and I get as a response the key string. 他们不起作用,我得到了响应。

But if I use it like this: 但是,如果我这样使用它:

messages.en.yml messages.en.yml

admin_form_label_identifier_identificationTitle: some text here

the view 风景

{{ 'admin_form_label_identifier_identificationTitle'|trans }}

it works. 有用。

Obviously I don't want to have this format but use the nice array formatted option. 显然,我不想使用这种格式,而是使用漂亮的数组格式化选项。 Is this even possible in Sonata Admin? 在Sonata Admin中甚至可以做到吗?

I suposse that somewhere in your project there is translation for admin.form.label. 我猜想在您的项目中某处有admin.form.label的翻译。

When you define the same key as value and also as array, only one of translation work. 当您将相同的键定义为值和数组时,仅翻译功能之一。 Eg: 例如:

 admin: translation for admin
 admin:
    form:  translation for admin.form

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM