zendframework / zend-form

Form component from Zend Framework
BSD 3-Clause "New" or "Revised" License
69 stars 87 forks source link

Zend Fieldset translation breaks when using formRow helper before #112

Open didgewind opened 8 years ago

didgewind commented 8 years ago

Hi, in a view, when using $this->formRow on a fieldset element then translation is not working for helper $this->formLabel on another element of the same fieldset.

I'm using zend 2.5.1. My simplified view is like this:

$form->prepare();
$busquedas = $form->get('busquedasFS');
echo $this->form()->openTag($form). "\n\n";
echo $this->formRow($busquedas->get('tipoBusqueda')). "\n";
echo $this->formLabel($busquedas->get('palabrasClaveBusqAvanzada')). ' - '.
$this->formText($busquedas->get('palabrasClaveBusqAvanzada')). "\n";
echo $this->form()->closeTag();

$busquedas is a fieldset. With this code translation is not working for element palabrasClaveBusqAvanzada. But if I change $this->formRow($busquedas->get('tipoBusqueda')) for $this->formHidden($busquedas->get('tipoBusqueda') then translation IS working for palabrasClaveBusqAvanzada.

My translation is defined like this:

return array(
    'service_manager' => array(
        'factories' => array (
                   '...',
                   'translator' => 'Zend\Mvc\Service\TranslatorServiceFactory',
        ),
    ),
    'translator' => array(
        'locale' => 'es_ES',
        'translation_file_patterns' => array(
            array(
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
                'text_domain' => 'salesianos_td'
            ),
        ),
    ),
weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at https://github.com/laminas/laminas-form/issues/26.