cinghie/yii2-multilanguage
Composer 安装命令:
composer require cinghie/yii2-multilanguage
包简介
Multi Language support for Yii2 Framework.
README 文档
README
Multi Language support for Yii2 Framework based on this post on Official Forum:
http://www.yiiframework.com/forum/index.php/topic/56027-yii2-multilingual-website-url-rules/
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require cinghie/yii2-multilanguage "*"
or add this line to the require section of your composer.json file.
"cinghie/yii2-multilanguage": "*"
Configuration
Set in Configuration File:
// Language Settings
'language' => 'en',
'sourceLanguage' => 'en_GB',
Make sure you have set the parameter 'language': the default language will be that
Set URL Manager in 'component' Configuration File:
// Url Manager
'urlManager' => [
'class' => 'codemix\localeurls\UrlManager',
'languages' => ['en', 'it', 'fr', 'de', 'es'], // List all supported languages here
'enablePrettyUrl' => true,
'showScriptName' => false,
],
Images
Copy the img folder from the project root to your web folders to see flag's images
Widgets
You can load the MultiLanguage Widget in the your view like this:
<?= MultiLanguageWidget::widget([
'addCurrentLang' => true, // add current lang
'calling_controller' => $this->context,
'image_type' => 'classic', // classic or rounded
'link_home' => true, // true or false
'widget_type' => 'classic', // classic or selector
'width' => '28'
]); ?>
There are 4 params in the Widget:
- Widget Type can be classic or selector
- Image Type can be classic or rounded
- Width in pixel of the flags
- The Calling Controller (Do not Edit)
Changelog
- Version 2.0.2 - Adding options to add current Lang on widgets
- Version 2.0.1 - Adding Ca, Ch, In, Ne, Ru, Us flags
- Version 2.0.0 - Refactoring project adding Yii2 Locale URLs: https://github.com/codemix/yii2-localeurls
- Version 1.2.0 - Minor improvements
- Version 1.1.2 - Fixing error to extends yii Widget problem
- Version 1.1.1 - Update Copyright and license
- Version 1.1.0 - Bug Fixed not home View
- Version 1.0.0 - Initial Release
cinghie/yii2-multilanguage 适用场景与选型建议
cinghie/yii2-multilanguage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.02k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2015 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2 multilanguage」 「yii2 language」 「yii2 lang」 「yii2 translate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cinghie/yii2-multilanguage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cinghie/yii2-multilanguage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cinghie/yii2-multilanguage 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Easy to use i18n translation PHP class for multi-language websites
Puts the Symfony Translation Component on steroids
Package for convenient work with Laravel's localization features
Store your language lines in the database, yaml or other sources
统计信息
- 总下载量: 6.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 22
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-01-24