On Wed, Mar 12, 2014 at 10:07 AM, Ralf Eggert <r.egg...@travello.de> wrote:
> I found another one:
>
>   use Zend\I18n\Translator\Translator;
>
>   AbstractValidator::setDefaultTranslator(
>     Translator::factory($this->config['translations']['validator'])
>   );
>
> Does not work, since AbstractValidator::setDefaultTranslator() expects
> the implementation of the Zend\Validator\Translator\TranslatorInterface
> which is only implemented by Zend\Mvc\I18n\Translator.
>
> Is this intended to pass the MvcTranslator instance from the
> Service-Manager and add the translation texts to it rather than having a
> special translator instance for validator messages?

Actually, this has been true since *2.2.0*! In that release, we
modified the Validator component to define its own
TranslatorInterface. Zend\Mvc\I18n\Translator was introduced at that
time as well, and, at the time, extended
Zend\I18n\Translator\Translator and implemented the validator's
TranslatorInterface. The MVC translator would be what you would need
to pass to validators to enable translation.

As such, the above example would not have worked at any time in the 2.2 series.

-- 
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


Reply via email to