Index: File/Transfer/Adapter/Abstract.php =================================================================== --- File/Transfer/Adapter/Abstract.php (révision 11182) +++ File/Transfer/Adapter/Abstract.php (copie de travail) @@ -20,7 +20,7 @@ */ /** Zend_Validate_Interface */ -require_once 'Zend/Validate/Interface.php'; +require_once 'Zend/Validate/Abstract.php'; /** * Abstract class for file transfers (Downloads and Uploads) @@ -30,7 +30,7 @@ * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_File_Transfer_Adapter_Abstract implements Zend_Validate_Interface +abstract class Zend_File_Transfer_Adapter_Abstract extends Zend_Validate_Abstract { /**@+ * @const string Plugin loader Constants @@ -471,12 +471,16 @@ public function isValid($files) { $check = $this->_getFiles($files); + $translator = $this->getTranslator (); $this->_messages = array(); foreach ($check as $file => $content) { $uploaderror = false; if (array_key_exists('validators', $content)) { foreach ($content['validators'] as $class) { $validator = $this->_validators[$class]; + if (method_exists($validator, 'setTranslator')) { + $validator->setTranslator($translator); + } if (!$uploaderror and !$validator->isValid($content['tmp_name'], $content)) { $this->_messages += $validator->getMessages(); } Index: Form/Element/File.php =================================================================== --- Form/Element/File.php (révision 11182) +++ Form/Element/File.php (copie de travail) @@ -256,6 +256,11 @@ public function isValid($value, $context = null) { $adapter = $this->getTransferAdapter(); + // Check if the method exists because may be there will be created in the future + // a Zend_File_Transfer_Adapter_Interface interface that doesn't have this one. + if (method_exists($adapter, 'setTranslator')) { + $adapter->setTranslator ($this->getTranslator ()); + } $this->setValue($adapter->getFileName($this->getName())); if (!$this->isRequired() && empty($value)) {