Issues

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

Issue Type: Bug Created: 2009-03-21T09:51:04.000+0000 Last Updated: 2009-11-19T22:18:55.000+0000 Status: Resolved Fix version(s): Reporter: Matteo Albinola (leopgia) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: - ZF-6877

Attachments:

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

Posted by Miroslav Kubelik (koubel) on 2009-05-10T11:42:41.000+0000

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

Posted by Steve Lounsbury (stephenminded) on 2009-11-19T22:18:55.000+0000

Duplicate of ZF-6877 which is fixed.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts