Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.
/ zf-localize-helper Public archive

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

License

Notifications You must be signed in to change notification settings

fabiang/zf-localize-helper

Repository files navigation

ZF Localize helper

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published