问题描述
我已经开始使用Sonata Admin软件包了.它非常方便并且易于设置和使用,但是我似乎无法将默认标签的翻译固定下来
I have started new with the sonata admin bundle. its very handy and easy to setup and use , but i can't seem to get the translation fixed for the default labels
例如,出现了link_add,link_list而不是适当的英文标签.
e.g link_add, link_list are coming instead of proper english labels.
#SonataAdmin
sonata_block:
default_contexts: [cms]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
sonata.block.service.text:
sonata.block.service.rss:
sonata_admin:
title: Sonata Project
title_logo: /bundles/sonataadmin/logo_title.png
templates:
# default global templates
layout: SonataAdminBundle::standard_layout.html.twig
ajax: SonataAdminBundle::ajax_layout.html.twig
# default actions templates, should extend a global templates
list: SonataAdminBundle:CRUD:list.html.twig
show: SonataAdminBundle:CRUD:show.html.twig
edit: SonataAdminBundle:CRUD:edit.html.twig
dashboard:
blocks:
# display a dashboard block
- { position: left, type: sonata.admin.block.admin_list }
这是我的配置文件,这些是文档提供的基本默认设置.我在这里缺少为默认视图参数启用标签的内容吗?谁能帮忙
This is my config file and these are the basic default settings provided by the documentation. what am i missing here to enable labels for the default view params ? can anybody help
推荐答案
用于翻译菜单和表格覆盖文件:SonataAdminBundle.[your_language].xliff
(内容来自:vendor/sonata-project/admin-bundle/Sonata/AdminBundle/Resources/translations/SonataAdminBundle.[your_language].xliff
),将文件放入:
for translate menu and forms override file: SonataAdminBundle.[your_language].xliff
(with content from: vendor/sonata-project/admin-bundle/Sonata/AdminBundle/Resources/translations/SonataAdminBundle.[your_language].xliff
), put file in:
app/Resource/SonataAdminBundle/translations/
完整路径:
app/Resource/SonataAdminBundle/translations/SonataAdminBundle.[your_language].xliff
如果要翻译字段的标签,则必须在捆绑包中创建翻译文件,例如:
If you want to translate your labels for field, you must create translate file in your bundle, for example:
src/YourAlias/YourNameOfBundle/Resources/translations/YourAliasYourNameOfBundle.[your_language].xliff
如果您的Admin
班级在
src/YourAlias/YourNameOfBundle/Admin/YourClassAdmin.php
Sonata
使用FOSUserBundle
,如果要更改用户模块的翻译,则必须在以下位置使用ovverride文件:FOSUserBundle.[your_language].yml
:
Sonata
use FOSUserBundle
and if you want change translation for users module, you must ovverride file: FOSUserBundle.[your_language].yml
in:
app/Resource/FOSUSerBundle/translations/FOSUserBundle.[your_language].yml
并类似地用于SonataUserBundle
我使用该配置,一切正常!
I use that configuration and everything works!
这篇关于Sonata Admin捆绑包中的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!