Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

What is the point of Zend\Validator\Translator\TranslatorInterface? #48

Closed
@RalfEggert

Description

@RalfEggert

I am just trying to internationalize my Zend\Expressive application and stumbled upon the Zend\Validator\Translator\TranslatorInterface interface, which is checked when I use Zend\Validator\AbstractValidator::setDefaultTranslator() method. I learned now that I cannot use a normal Zend\I18n\Translator\Translator instance. In a Zend\Mvc scenario this issue is solved by the Zend\Mvc\I18n\Translator which uses an Zend\I18n\Translator\Translator instance and implements the Zend\Validator\Translator\TranslatorInterface interface.

It doesn't feel right to use the Zend\Mvc\I18n\Translator within my Zend\Expressive application.

It doesn't feel right to implement a Zend\Expressive\I18n\Translator similar to the Zend\Mvc\I18n\Translator.

What a mess.

So, what is the point of the Zend\Validator\Translator\TranslatorInterface in the first place? The Zend\I18n\Translator\TranslatorInterface has the same method signature for the translate() method except it adds another translatePlural() method to the interface. Why not split Zend\I18n\Translator\TranslatorInterface into two interfaces and kick Zend\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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions