ibrows / sonata-translation-bundle
Lexik翻译集成到Sonata管理后台
1.1.1
2015-07-03 09:55 UTC
Requires
- php: >=5.3.0
- lexik/translation-bundle: *
- sonata-project/admin-bundle: *
- symfony/framework-bundle: >=2.1
This package is auto-updated.
Last update: 2024-09-15 19:50:07 UTC
README
SonataTranslationBundle是将LexikTranslationBundle集成到SonataAdminBundle中。
安装
在您的composer.json中添加以下行
{
"require": {
"ibrows/sonata-translation-bundle" : "dev-master",
}
}
要开始使用此包,请在应用程序的内核类中注册SonataTranslationBundle和LexikTranslationBundle
<php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Lexik\Bundle\TranslationBundle\LexikTranslationBundle(),
new Ibrows\SonataTranslationBundle\IbrowsSonataTranslationBundle(),
);
)
配置
SonataTranslationBundle
无需初始配置。
但是,您可以配置一些选项来编辑外观。以下为默认配置:
# app/config/config.yml
ibrows_sonata_translation:
defaultDomain: messages
editable:
mode: inline # Mode of editable, can be popup or inline
type: textarea # Type of input. Can be text|textarea|select|date|checklist and more
emptytext: Empty # text to display on empty translations
placement: top # ingnored for inline mode
LexikTranslationBundle
最小配置包括
# app/config/config.yml
lexik_translation:
fallback_locale: en # (required) default locale to use
managed_locales: [en] # (required) locales that the bundle have to manage
有关其他配置选项,请参阅官方文档
为了在管理面板中显示一些键,您必须首先导入翻译文件。这可以通过LexikTranslationBundle提供的命令来完成。
./app/console lexik:translations:import [bundleName] [--cache-clear] [--force] [--globals]
请再次参考官方文档以获取更多信息。
使用方法
要将此包包含在管理仪表板中,请将“group.translation”组添加到仪表板
# app/config/config.yml
sonata_admin:
dashboard:
groups:
group.translation:
label: Translation
items: ~
关于这一点,就这么多(;)。