Closed RalfEggert closed 8 years ago
Segregation of Interfaces and remove the i18n dependency
Please clarify! I don't get it.
So the dependency to Zend\I18n
was removed to the costs of a Zend\Mvc
dependency?
Mvc offers a bridge for both interfaces but i18n neither validator depends of Mvc.
So in consequence I need to build my own bridge if I want to use the same Translator instance for I18n view helpers and validators if I am in an Zend\Expressive
environment and I don't want to use the MVC bridge?
If yes, it still feels kind of awkward...
This may suffer changes in future releases #24
I love the idea of stateless validators and keeping the whole translation stuff outside of the validator.
I am just trying to internationalize my
Zend\Expressive
application and stumbled upon theZend\Validator\Translator\TranslatorInterface
interface, which is checked when I useZend\Validator\AbstractValidator::setDefaultTranslator()
method. I learned now that I cannot use a normalZend\I18n\Translator\Translator
instance. In aZend\Mvc
scenario this issue is solved by theZend\Mvc\I18n\Translator
which uses anZend\I18n\Translator\Translator
instance and implements theZend\Validator\Translator\TranslatorInterface
interface.It doesn't feel right to use the
Zend\Mvc\I18n\Translator
within myZend\Expressive
application.It doesn't feel right to implement a
Zend\Expressive\I18n\Translator
similar to theZend\Mvc\I18n\Translator
.What a mess.
So, what is the point of the
Zend\Validator\Translator\TranslatorInterface
in the first place? TheZend\I18n\Translator\TranslatorInterface
has the same method signature for thetranslate()
method except it adds anothertranslatePlural()
method to the interface. Why not splitZend\I18n\Translator\TranslatorInterface
into two interfaces and kickZend\Validator\Translator\TranslatorInterface
?Are there any plans to tidy this up? Anyway what about the plans to make the validators stateless and extract the translation part from it? I think both is really needed for a ZF3 release to make translation and validation usable within a
Zend\Expressive
application.