ZF-8247: Zend_Form_Element_File label is not translated


Zend_Form_Element_File label is not translated when the form element is rendered separately.


// controller
$form = new Zend_Form();
$form->addElement('file', 'myFile', array('label' => 'fileLabel', 'required' => false));
$form->addElement('text', 'myText', array('label' => 'textLabel', 'required' => false));
$form->addElement('submit', 'mySubmit', array('label' => 'submitLabel'));
$this->view->form = $form;

// view
<?= $this->form->renderForm(false) ?>
<?= $this->form->myFile ?>
<?= $this->form->myText ?>
<?= $this->form->mySubmit ?>

"textLabel" and "submitLabel" are correctly translated, "fileLabel" is not translated.

If the form is rendered in such a way:

// view
<?= $form ?>

then all labels are translated correctly.


It seems that the translator is not set when Zend_Form_Element_File is rendered separately. If I set the translator explicitely (Zend_Form_Element_File::setTranslator()) in the controller before rendering the form, then translation works fine.

There is no translator set... wether in the form nor within the element. So how should translation work without a translation instance?

I expect missing informations...

Closing as not reproducable.