Issue Type: Patch Created: 2008-09-01T04:38:30.000+0000 Last Updated: 2008-10-19T14:59:22.000+0000 Status: Resolved Fix version(s): - 1.6.2 (13/Oct/08)
Reporter: Adrien13 (adrien13) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form
Related issues: Attachments: - zend-issue.diff
I use zend translator with my forms to translate error messages, and it goes well. But this doesn't work with file form element. I found a fix and I place the diff in attachment.
To fix the problem I try to reproduce the behavior of the other form elements. So first, the Zend_Form_Element_File#isValid function had to pass the translator on the transfer adapter by using the Zend_File_Transfer_Adapter_Abstract#setTranslator method. Then, the transfer adapter does the same thing by calling setTranslator on validators that have the method (such as Zend_Validate_Abstract). The last thing that need to be added, is the Zend_File_Transfer_Adapter_Abstract#setTranslator method. Normally, validators have this method, but the transfer adapter inherits from Zend_Validate_Interface and not Zend_Validate_Abstract. In the fix, I suggest to change the inheritance because it doesn't need a lot of changes. But I think that require more cpu and memory usage and perhaps that will cause others problems.
I work on the 11181 Zend Framework revision.
Thanks for reading.
Posted by Adrien13 (adrien13) on 2008-09-01T04:42:36.000+0000
Diff file that patches the translation file form element problem.
Posted by Thomas Weidner (thomas) on 2008-09-01T13:32:13.000+0000
Code can not be used as is... implementation problems with other new features
Posted by Adrien13 (adrien13) on 2008-09-02T01:18:48.000+0000
Which part of the code affects these new features ? An other solution may be to call :
<pre class="highlight"> parent::isValid($value, $context);
in the Zend_Form_Element_File#isValid method. But I think this would require more modifications.
Otherwise how can this bug be fixed ? I use a lot of translation with forms and I would appreciate a solution with file elements. If I can help by suggesting other solutions, I volunteer.
Posted by Thomas Weidner (thomas) on 2008-09-21T05:39:37.000+0000
Should now work with latest trunk release. Please give it a test and me a response.
I will close this issue as resolved if there is no response until 23.Sept.
Posted by l c (cromulent) on 2008-10-19T14:59:21.000+0000
Not sure what happened to the original person who reported this, but this doesn't appear to be fixed in 1.6.2
If you specify a translator via Zend_Form using setDefaultTranslator, the translator is still null when processed by Zend_File_Transfer_Adapter_Abstract.php so the error message is not being translated.
Have you found an issue?
See the Overview section for more details.