tecnocreaciones/sonata-translation-bundle

Lexik翻译集成到Sonata管理后台

安装: 116

依赖者: 0

建议者: 0

安全: 0

星级: 0

关注者: 3

分支: 31

类型:symfony-bundle

1.0.12 2014-11-12 16:28 UTC

This package is auto-updated.

Last update: 2024-08-29 04:09:02 UTC


README

SonataTranslationBundle 是将 LexikTranslationBundle 集成到 SonataAdminBundle 中的工具。

image

安装

在您的 composer.json 文件中添加以下行

{
    "require": {
		"ibrows/sonata-translation-bundle" : "dev-master",
    }
}

要开始使用此包,请在您的应用程序的内核类中注册 SonataTranslationBundle 和 LixikTranslationBundle

<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: ~ 

关于它的描述就这么多 ;)