This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 136
What is the point of Zend\Validator\Translator\TranslatorInterface? #48
Comments
Segregation of Interfaces and remove the i18n dependency |
Please clarify! I don't get it. |
So the dependency to |
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 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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.The text was updated successfully, but these errors were encountered: