Zend Framework

Zend_Form_Element_File label is not translated

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Form
  • Labels:
    None

Description

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

example:

// controller
$form = new Zend_Form();
$form->setEnctype('multipart/form-data');
$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 ?>
</form>

"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.

Activity

Hide
Bart Blaszczyk added a comment -

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.

Show
Bart Blaszczyk added a comment - 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.
Hide
Thomas Weidner added a comment -

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...

Show
Thomas Weidner added a comment - 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...
Hide
Thomas Weidner added a comment -

Closing as not reproducable.

Show
Thomas Weidner added a comment - Closing as not reproducable.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: