Zend Framework

Zend_Form_Decorator_FormErrors does not use I18n on label

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Form
  • Labels:
    None

Description

Forms with a translator do not translate element labels in the list of form errors. I believe the problem exists in Zend_Form_Decorator_FormErrors::renderLabel. Following a similar pattern to Zend_Form_Decorator_Label, the following patch should provide the functionality (patch against trunk r15870):

Index: library/Zend/Form/Decorator/FormErrors.php
===================================================================
— library/Zend/Form/Decorator/FormErrors.php (revision 15870)
+++ library/Zend/Form/Decorator/FormErrors.php (working copy)
@@ -351,6 +351,10 @@
$label = $element->getName();
}

+ if (null !== ($translator = $element->getTranslator())) { + $label = $translator->translate($label); + }
+
return $this->getMarkupElementLabelStart()
. $view->escape($label)
. $this->getMarkupElementLabelEnd();

Thanks

Issue Links

Activity

Hide
Steve Lounsbury added a comment -

Sorry, patch doesn't seem to come out that well. I can provide a file if needed.

Show
Steve Lounsbury added a comment - Sorry, patch doesn't seem to come out that well. I can provide a file if needed.
Hide
Harro van der Klauw added a comment -

Hey Steve,
There is an attach file function for issues.

Please use that to attach the patch.

Show
Harro van der Klauw added a comment - Hey Steve, There is an attach file function for issues. Please use that to attach the patch.
Hide
Steve Lounsbury added a comment -

Diff attached. Sorry, I didn't see the "attach a file" link at first.

Show
Steve Lounsbury added a comment - Diff attached. Sorry, I didn't see the "attach a file" link at first.
Hide
Thomas Weidner added a comment -

Given patch not correct.
Fixed with r18965.

Show
Thomas Weidner added a comment - Given patch not correct. Fixed with r18965.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: