fabiang / zf-localize-helper
Zend Framework module for setting locale to all view helpers, validators and filters
Requires
- php: ^5.5 || ^7.0
- zendframework/zend-filter: ^2.0
- zendframework/zend-servicemanager: ^2.7.6 || ^3.0
- zendframework/zend-validator: ^2.0
- zendframework/zend-view: ^2.0
Requires (Dev)
- behat/behat: ^3.2.1
- phpunit/phpunit: ^4.8.26 || ^5.5.5
- zendframework/zendframework: ^2.5 || ^3.0
This package is auto-updated.
Last update: 2022-03-14 16:48:01 UTC
README
Initializer that passes your configured locale to all view helpers, validators and filters, so you don't have to do this every time.
Requirements
This module works with Zend Framework 2 and 3, but
zendframework/zend-servicemanager
must be at least at version 2.7.6.
Please see the composer.json file.
Installation
Run the following composer
command:
$ composer require fabiang/zf-localize-helper
Configuration
Put the following into your plugin managers config (e.g. config/autoload/i18n.global.php
):
<?php return [ 'translator' => [ 'locale' => 'en_US', // this locale will be passed ], 'validators' => [ 'initializers' => [ \Fabiang\LocalizeHelper\LocaleInitializer::class, ] ], 'filters' => [ 'initializers' => [ \Fabiang\LocalizeHelper\LocaleInitializer::class, ] ], 'view_helpers' => [ 'initializers' => [ \Fabiang\LocalizeHelper\LocaleInitializer::class, ] ] ];
You can configure the initializer for each type of plugin by removing or adding it to the ValidatorManager/FilterManager/ViewHelperManager config above.
LICENSE
BSD-2-Clause. See the LICENSE.