fabiankoestring/locale-template-map-resolver

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (2.0.1) of this package.

LocaleTemplateMapResolver is a small ZF2 module that provides a template map resolver to load locale specific templates.

2.0.1 2020-03-06 13:04 UTC

This package is auto-updated.

Last update: 2020-04-27 11:00:20 UTC


README

LocaleTemplateMapResolver is a small ZF2 module that provides a template map resolver to load locale specific templates.

Installation

LocaleTemplateMapResolver works with Composer. To install it into your project, just run following command:

composer require fabiankoestring/locale-template-map-resolver

Finally enable the module by adding LocaleTemplateMapResolver in your application.config.php file.

Example 1:

With this given directory structure and a template map the LocaleTemplateMapResolver won´t do anything. It retuns false and the default zend view resolvers will do their job.

Folder

Application > view > application > index > index.phtml

Config

'template_map' => [
    'application\index' => __DIR__ . '/../view/application/index/index.phtml'
]

Example 2:

With this given directory structure and a template map the LocaleTemplateMapResolver will match the view template to the current locale. If no view template could be found that matches the current locale, the default view template will be used.

Folder

Application > view > application > index > index.phtml
Application > view > application > index > index-de_DE.phtml
Application > view > application > index > index-en_EN.phtml

Config

'template_map' => [
    'application\index' => __DIR__ . '/../view/application/index/index.phtml'
]