bushbaby/bsb-translate-controller-plugin
最新稳定版本:1.0.2
Composer 安装命令:
composer require bushbaby/bsb-translate-controller-plugin
包简介
BsbTranslateControllerPlugin is a ZF2 module that provides controller plugin to expose the translator.
README 文档
README
BsbTranslateControllerPlugin is a small ZF2 module that registers a translator as controller plugin.
Installation
BsbTranslateControllerPlugin works with Composer. To install it into your project, just add the following line into your composer.json file:
"require": {
"bushbaby/bsb-translate-controller-plugin": "~1.0.0"
}
Then update your project by runnning composer.phar update.
Finally enable the module by adding BsbTranslateControllerPlugin in your application.config.php file.
Usage
Within an action controller you as plugins would use the translate and translatePlural view helpers.
Instead of using something ugly as;
$helper = $this->getServiceLocator()->get('viewhelpermanager')->get('translate');
echo $helper('message');
Use this;
echo $this->translate('message');
Instead of using something ugly as;
$helper = $this->getServiceLocator()->get('viewhelpermanager')->get('translateplural');
echo sprintf($helper('%s message', '%s messages', $number), $number);
Use this;
echo sprintf($this->translatePlural('%s message', '%s messages', $number), $number);
统计信息
- 总下载量: 2.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-10-11