coolshop/cool-sonata-translation-bundle
Composer 安装命令:
composer require coolshop/cool-sonata-translation-bundle
包简介
Integration of translation into sonata admin
关键字:
README 文档
README
The CoolSonataTranslationBundle is the bundle that manage to handle your Symfony Translations into Database. The integration with Sonata Admin is possible thanks to Ibrows
Installation
Add the following lines in your composer.json:
{
"require": {
"coolshop/cool-sonata-translation-bundle" : "^2.0",
}
}
To start using the bundle, register the CoolSonataTranslationBundle in your application's kernel class:
<php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Coolshop\CoolSonataTranslationBundle\CoolSonataTranslationBundle(),
);
)
Configuration
app/config/config.yml
cool_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
localeManager: '@cool_sonata_translation.locale_manager.sonatapage' #service that handles the locale available. Could be an array of locale (eg. localeManager: ['en', 'fr', 'es', 'de'])
driver: orm # Only ORM available at the moment.
database:
entity_manager: # if not specified will use default. This way you could handle translations with a separate EM.
Usage
Setup the translation table
./app/console doctrine:schema:update --force
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:
./app/console cool:translations:import [-c]
This command also has a "-c" so you can clear the database first. might be a bit faster for larger imports if your table is already filled.
Generate dummy translation files or using configuration
./app/console asm:translations:dummy
Since the TranslationLoader bases on files, you'd have to create empty files like "messages.en_US.db" for each language you want to use with your translation database. The files will be placed in app/Resources/translations/*
NOTE: each time you modify translations into DB you have to clear the cache in order to use the new one.
./app/console cache:clear
@TODO: make clear cache possible from admin panel.
Sonata Admin Integration
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: ~
That's all folks! Come to say Hi at Coolshop
coolshop/cool-sonata-translation-bundle 适用场景与选型建议
coolshop/cool-sonata-translation-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 70 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「translation」 「sonata」 「coolshop」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 coolshop/cool-sonata-translation-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coolshop/cool-sonata-translation-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 coolshop/cool-sonata-translation-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Sonata Extra admin features
ACL list filtering for SonataAdmin
A custom URL rule class for Yii 2 which allows to create translated URL rules
A Laravel Eloquent model trait for translatable resource
This bundle track command execution in the database.
统计信息
- 总下载量: 70
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-25
