ZF-9371: Zend_Form_Element duplicate and missing label translation Issues


In version 1.10.x

public function getLabel()
    $translator = $this->getTranslator();
    if (null !== $translator) {
        return $translator->translate($this->_label);

    return $this->_label;

It cause problem, because the translation is running twice. 1. When calling getLabel() 2. And the Translate adapter globaly

Before version 1.10.x worked fine.

public function getLabel()
    return $this->_label;


Updated title to reflect that this issue is a parent of SubTasks now.

After reading through the Sub Tasks, older issues and most important the Zend_Form-2.0 wiki, i will move all translate calls from Zend_Form and Zend_Form_Element_* into Zend_Form_Decorator_* // edit and into Zend_View_Helper_Form* according to where the final rendering occurs, in a way that the original Element attributes won't be translated.

We had a discussion in irc where wwe thought about implementing a Decorator_Translate to do all the translations for configured attribs and/or values.

Any Comments?

This may be a good idea or not, but it looks like a long term solution to me. For the moment, I'd be more than happy to see the fixes (which have been around for months and work flawlessly) finally make it into a release. It's really annoying to apply them after every update.

Is there any good reason why this has not been addressed yet?

vice versa linked...

Holger which fixes are you refering to?

One of the fixes (including tests) is attached to ZF-8764. I can't find the other one ATM (already too many open bug reports about this). I have attached a patch that fixes both issues (without the tests).

2011 and still no fix for this... Can it really be true that there's no committer that is willing to apply a patch? Why not just fix it to prevent translate-logs filling with garbage and developing cool things like Decorator_Translate later?

??developing cool things like Decorator_Translate??

Zend_Form 2.0 - Recommendations: Translation

{quote} Translation should be moved to the view layer. The View and Decorator chains would receive the Translator object and use it to translate appropriate labels and metadata. As such, the form, its elements, and the individual validator and validator chains would need no such knowledge of this information. {quote}

Duplicate of ZF-8694