Skip to content

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

License

Notifications You must be signed in to change notification settings

fabiang/laminas-localize-helper

Repository files navigation

Laminas Localize helper

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

Continuous Integration Latest Stable Version License

Installation

Run the following composer command:

$ composer require fabiang/laminas-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

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published