ZF-2568: No %value% substitution in translated validation messages

Issue Type: Bug Created: 2008-02-05T03:17:58.000+0000 Last Updated: 2008-03-21T16:25:47.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Jan Sorgalla (jsorgalla) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

  • Zend_Validate

Related issues: Attachments:


If a translator is used, Zend_Form_Decorator_Errors passes %value% (and additional message variables) subtitution in validation messages.


Posted by Arnaud DIDRY (adidry) on 2008-02-06T19:39:45.000+0000

I encountered the same problem trying to translate errors messages. I found that the translation were done in Zend_Form_Decorator_Errors, after that each error message were processed by the function Zend_Validate_Abstract::_createMessage

<pre class="highlight">
Zend_Form_Decorator_Errors::render () {

    // ...

        $errors = $element->getMessages();
        if (empty($errors)) {
            return $content;

        if (null !== ($translator = $element->getTranslator())) {
            foreach ($errors as $code => $message) {
                $errors[$code] = $translator->translate($code); // pre-processed messages are deleted here

Maybe that the translator should be passed to each validator to create localized validators

Posted by Matthew Weier O'Phinney (matthew) on 2008-02-07T15:59:20.000+0000

Available as of r7854 (make sure you update both incubator and core). Translations are now possible globally for all validators extending Zend_Validate_Abstract, which affects Zend_Validate, Zend_Form, and Zend_Filter_Input. This change also allows for variable substitution in messages.

Have you found an issue?

See the Overview section for more details.


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

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