ZF-6080: Field labels in error summary (made with FormErrors decorator) are not translated

Description

I use Zend_Translate in conjunction with Zend_Form (translation works, field's labels are correctly translated). I also set default FormErrors as a form decorator.

The problem is that FormErrors decorator don't translate retreived field labels in the summary, while error descriptions are correctly translated.

I changed FormErrors.php, located in zend_library\Form\Decorator\, in this way:

   if (null !== ($translator = $element->getTranslator())) {
        $label = $translator->translate($label);
    }

above lines of code were added to the method: public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view) So method become like this:

public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
{
    $label = $element->getLabel();
    if (empty($label)) {
        $label = $element->getName();
    }

if (null !== ($translator = $element->getTranslator())) {
        $label = $translator->translate($label);
    }

    return $this->getMarkupElementLabelStart()
         . $view->escape($label)
         . $this->getMarkupElementLabelEnd();
}

Now, fields' labels in error summary are translated!

Comments

Issue isn't resoved yet in 1.7.8 and maybe also in 1.8

Duplicate of ZF-6877 which is fixed.