On Sun, Oct 20, 2013 at 6:41 AM, Juan Pedro Gonzalez <unaputacue...@hotmail.com> wrote: > Shouldn't TranslatorAwareTreeRouteStack contain a factory method in order to > load a translator? > Maybe I'm wrong and there is an easier way to set the translator, but I guess > if the proper way to set the TranslatorAwareTreeRouteStack is: > 'router' => array( 'router_class' => > 'Zend\Mvc\Router\Http\TranslatorAwareTreeRouteStack', ) > Wouldn't it be logical to be able to do the same with the translator? > 'router' => array( 'router_class' => > 'Zend\Mvc\Router\Http\TranslatorAwareTreeRouteStack', > 'router_translator' => array( 'translation_file_patterns' => > array( array( 'type' => 'gettext', > 'base_dir' => __DIR__ . '/../routes', > 'pattern' => '%s.mo', ), ), ) ) > I added a pull request https://github.com/zendframework/zf2/pull/5300 > ...but if there is an already implemented method to load the translator it > would be great to know how it is done. We have an "initializer" in the MVC service config that:
- Determines if an object created by the ServiceManager is TranslatorAware - Determines if we have a Translator service - and if both are true, injects the Translator service into the new object In other words, it's completely automated, assuming you're using the ServiceManager (which you are). -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com