Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Invalid plugin phpArray #55

Closed
xorock opened this issue Aug 31, 2016 · 2 comments
Closed

Invalid plugin phpArray #55

xorock opened this issue Aug 31, 2016 · 2 comments

Comments

@xorock
Copy link

xorock commented Aug 31, 2016

I'm using delegator factory as shown in docs for zend-i18n-resources (https://github.com/zendframework/zend-i18n-resources/blob/master/doc/book/usage.md). I'm not sure if it's a bug inside documentation or missing alias for Service Manager.
https://github.com/zendframework/zend-i18n/blob/master/src/Translator/LoaderPluginManager.php#L62
Here We can see definition only for lowercased 'phparray' key, so 'phpArray' won't work.

Another thing is delegator config:

return [
    'service_manager' => [
        'delegators' => [
            'MvcTranslator' => [
                'TranslatorDelegator',
            ],
        ],
    ],
];

MvcTranslator key will not trigger TranslatorDelegator (I'm using this to translate validator messages inside form generated with Zend\Form\View\Helper\Form). Instead, I had to create this as follows:

use Zend\Mvc\I18n\Translator;
...
'service_manager' => [
        'delegators' => [
            Translator::class => [
                TranslatorDelegator::class,
            ],
        ],
    ],

Shouldn't locale be normalized and maybe even merged, for example

'translator' => [
        'locale' => 'pt_BR',
    ],

First, class should look for pt_BR translation, then pt and if both exist, merge them.

@samsonasik
Copy link
Contributor

there is PR for it #56

@froschdesign
Copy link
Member

Fixed with #56

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants