fabiankoestring / locale-template-map-resolver
LocaleTemplateMapResolver is a small ZF2 module that provides a template map resolver to load locale specific templates.
Installs: 4 907
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: >=7.4.0
- ext-intl: ~7.4
- laminas/laminas-loader: ~2.6.1
- laminas/laminas-mvc: ~3.1.1
- laminas/laminas-servicemanager: ~3.4.0
- laminas/laminas-view: ~2.11.4
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' ]