ZF-8713: Zend_Form_Decorator_FormErrors add translation for Name
Description
This function doesn't translate the label/name
/**
* Render element label
*
* @param Zend_Form_Element $element
* @param Zend_View_Interface $view
* @return string
*/
public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
{
$label = $element->getLabel();
if (empty($label)) {
$label = $element->getName();
}
return $this->getMarkupElementLabelStart()
. $view->escape($label)
. $this->getMarkupElementLabelEnd();
}
You could resolve this with
public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
{
$label = $element->getLabel();
if (empty($label)) {
$label = $element->getName();
}
$translator = $element->getTranslator();
return $this->getMarkupElementLabelStart()
. $view->escape($translator->translate($label))
. $this->getMarkupElementLabelEnd();
}
Comments
Posted by etaty (etaty) on 2010-01-07T08:39:21.000+0000
you can close
Posted by Adam Lundrigan (adamlundrigan) on 2011-10-31T17:32:52.000+0000
A similar solution was implemented for {{Zend_Form_Element_Submit}} previously as part of ZF-8764:
Is it OK to change it here as well? Or, would changing the label translation in FormErrors at this stage constitute a BC break?
Posted by Frank Brückner (frosch) on 2013-02-13T16:47:31.000+0000
Fixed on trunk (25256) and release-1.12 (25257)