Download the PHP package bushbaby/bsb-translate-controller-plugin without Composer
On this page you can find all versions of the php package bushbaby/bsb-translate-controller-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bushbaby/bsb-translate-controller-plugin
More information about bushbaby/bsb-translate-controller-plugin
Files in bushbaby/bsb-translate-controller-plugin
Package bsb-translate-controller-plugin
Short Description BsbTranslateControllerPlugin is a ZF2 module that provides controller plugin to expose the translator.
License MIT
Homepage https://github.com/bushbaby/BsbTranslateControllerPlugin
Informations about the package bsb-translate-controller-plugin
BsbTranslateControllerPlugin
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);
All versions of bsb-translate-controller-plugin with dependencies
zendframework/zend-i18n Version >=2.2.2
zendframework/zend-modulemanager Version >=2.2.2
zendframework/zend-mvc Version >=2.2.2
zendframework/zend-servicemanager Version >=2.2.2