简体   繁体   English

列表列的Sonata Admin本地翻译策略

[英]Sonata Admin local translation strategy for a list column

Is there an easy way to adjust a local translation strategy for a field added to a listMapper ? 有没有一种简单的方法可以为添加到listMapper的字段调整本地翻译策略? So the column header will be shown exactly how it's been written in a label attribute without any gaps. 因此,将准确显示列标题是如何在label属性中写入的,没有任何间隙。

BusinessUserAdmin.php BusinessUserAdmin.php

protected function configureListFields(ListMapper $listMapper)
{
    $listMapper
        ->add('company', null, [
            'label' => 'Company'
        ])
}

This is how it looks like now: 现在是这样的:

'label' => 'Company' 'label' => 'COmpany' 'label' => 'COMPANY' '标签'=>'公司' '标签'=>'公司' '标签'=>'公司

公司 公司 公司

When you register your admin class as service and tag it with : sonata.admin , there is additional option label_translator_strategy="sonata.admin.label.strategy.underscore” 当您将管理类注册为服务并标记为: sonata.admin ,还有其他选项label_translator_strategy="sonata.admin.label.strategy.underscore”

You can find more info here : 您可以在这里找到更多信息:

https://sonata-project.org/bundles/admin/master/doc/reference/translation.html https://sonata-project.org/bundles/admin/master/doc/reference/translation.html

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

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