-- Ralf Eggert <[email protected]> wrote
(on Wednesday, 22 August 2012, 10:31 PM +0200):
> > I haven't worked with the form helpers yet, so I'm not sure exactly
> > how they work... but I seem to recall seeing some discussion about a
> > pattern for injecting translators into helpers.  There may be some
> > way to make this happen through DI or service manager configuration,
> > but I'm afraid I don't know the details.  Maybe somebody more
> > familiar with these components can help.
> 
> I looked at the code again and I think there is no functionality to set
> a translator for all view helpers. The methods for setting translators
> lie in the Zend\I18n\View\Helper\AbstractTranslatorHelper and each view
> helpers that extends this abstract class will hold his own translator.
> 
> Is this wanted or could we add a translator for all view helpers somehow?

I think we should add an initializer for this to the HelperManager.
Basically, it would check if the helper extends
AbstractTranslatorHelper, and, if so, and we have a translator service
(see Zend\I18n\Translator\TranslatorServiceFactory), it would inject the
translator into the helper.

Anybody want to do a PR for me?

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to