fabiang/zf-localize-helper

This package is abandoned and no longer maintained. The author suggests using the fabiang/laminas-localize-helper package instead.

Zend Framework module for setting locale to all view helpers, validators and filters

1.0.1 2016-09-29 09:40 UTC

This package is auto-updated.

Last update: 2022-03-14 16:48:01 UTC


README

Laminas version is available.

Initializer that passes your configured locale to all view helpers, validators and filters, so you don't have to do this every time.

Latest Stable Version License Dependency Status Build Status

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.