定制 tecnocreaciones/sonata-translation-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tecnocreaciones/sonata-translation-bundle

最新稳定版本:1.0.12

Composer 安装命令:

composer require tecnocreaciones/sonata-translation-bundle

包简介

Integration of lexik translation into sonata admin

README 文档

README

The SonataTranslationBundle is an integration of the LexikTranslationBundle into the SonataAdminBundle.

image

Installation

Add the following lines in your composer.json:

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

To start using the bundle, register the SonataTranslationBundle and LixikTranslationBundle in your application's kernel class:

<php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
		new Lexik\Bundle\TranslationBundle\LexikTranslationBundle(),
		new Ibrows\SonataTranslationBundle\IbrowsSonataTranslationBundle(),
    );
)

Configuration

SonataTranslationBundle

No initial configuration is necessary.

However there are some options you can configure in order to edit the look. Below the default configuration is shown:

# 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

The minimal configuration consists of:

# 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

For additional configuration options please refer to the official documentation

In order to have some keys shown up in the admin panel, you have to import the translation files first. This is done through a command offered by LexikTranslationBundle:

./app/console lexik:translations:import [bundleName] [--cache-clear] [--force] [--globals]

Once again refer to the official documentation for additional information.

Usage

To include the bundle in the admin dashboard, add group "group.translation" to dashboard

# app/config/config.yml
sonata_admin:
    dashboard:
        groups:
            group.translation:
                label: Translation
                items: ~ 

There really is not more to say about it ;).

统计信息

  • 总下载量: 119
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 30
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-14