cinghie/yii2-dictionary
Composer 安装命令:
composer require cinghie/yii2-dictionary
包简介
Yii2 Dictionary to create, manage, and delete Multilanguage Dictionary in a Yii2 site.
README 文档
README
Yii2 Dictionary to create, manage, and delete Multilanguage Dictionary in a Yii2 site.
Features
- Create a dictionary with key/value: for each key is possible to associate a translation to each language set on config
- Import from CSV
- Download as Plist
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require cinghie/yii2-dictionary "*"
or add
"cinghie/yii2-dictionary": "*"
Create database schema
Run the following command:
$ php yii migrate/up --migrationPath=@vendor/cinghie/yii2-dictionary/migrations
Configuration
Set on your configuration:
// Yii2 Dictionary
'dictionary' => [
'class' => 'cinghie\dictionary\Dictionary',
'dictionaryRoles' => ['admin'];
'languages' => [
'it-IT' => 'it-IT',
'en-GB' => 'en-GB',
'es-ES' => 'es-ES',
'fr-FR' => 'fr-FR',
'de-DE' => 'de-DE',
'ch-CN' => 'ch-CN',
'pr-PR' => 'pr-PR',
'ru-RU' => 'ru-RU',
],
'showPlistDownload' => true,
'showTitles' => false,
'plistFolderPath' => '@webroot/dictionary/plist/';
'uploadFolderPath' => '@webroot/dictionary/csv/'
'uploadMaxFileSize' => 5242880
],
Set all language in Tag mode
Filters
If you have a Yii2 App Advanced (frontend/backend) you can exclude frontend actions
'modules' => [
'dictionary' => [
'class' => 'cinghie\dictionary\Dictionary',
'as frontend' => 'cinghie\dictionary\filters\FrontendFilter',
]
],
Overrides
Override controller example, on modules config
'modules' => [
'dictionary' => [
'class' => 'cinghie\dictionary\Dictionary',
'controllerMap' => [
'keys' => 'app\controllers\KeysController',
]
]
],
Override models example, on modules config
'modules' => [
'dictionary' => [
'class' => 'cinghie\dictionary\Dictionary',
'modelMap' => [
'Keys' => 'app\models\Keys'
]
]
],
Override view example, on components config
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@cinghie/dictionary/views/keys' => '@app/views/dictionary/keys',
],
],
],
],
Get Translation Value
use cinghie\dictionary\models\Keys;
$dictionary = new Keys();
$key = $dictionary::findOne(KeyID);
$value = $key->getTranslation(LangTag)->attributes['value'] ?: ''
cinghie/yii2-dictionary 适用场景与选型建议
cinghie/yii2-dictionary 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 257 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 03 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2 dictionary」 「yii2 translations」 「yii2 translation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cinghie/yii2-dictionary 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cinghie/yii2-dictionary 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cinghie/yii2-dictionary 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple, immutable data structures
A custom URL rule class for Yii 2 which allows to create translated URL rules
Dictionary implementation for PHP
Deepl Automated translations for Laravel lang files
Tresholds Governor, aims to facilitate the protection of authentication against brute force and dictionary attacks
A PHP/Laravel Wrapper for oxford dictionary API
统计信息
- 总下载量: 257
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-03-18