On Wed, Mar 12, 2014 at 10:07 AM, Ralf Eggert <[email protected]> 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            | [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