Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


formRow View Helper does not recognize / utilize injected translator service #2551

zfbot opened this Issue · 6 comments

4 participants

Zend Framework DevTeam Martin Keckeis Matthew Weier O'Phinney Maks3w
Zend Framework DevTeam

Jira Information

Original Issue: ZF2-516
Issue Type: Bug
Reporter: Michael Romer
Created: 09/03/12
Assignee: weierophinney
Components: Zend\Form


The FormRow-Helper seems not to use a translator service present for the label portion:

            'name' => 'username',
            'attributes' => array(
                'type'  => 'text',
            'options' => array(
                'label' => 'username',
public function onBootstrap($e)
echo $this->formRow($this->form->get('username')); 
echo $this->formLabel($this->form->get('username'));
Output incorrect: "username", even if translation available
Output correct: "Benutzername" (DE translation of "username")
Zend Framework DevTeam

(Originally posted by: froschdesign on 09/04/12)

Code tags added.

Zend Framework DevTeam

(Originally posted by: cgmartin on 09/05/12)

The FormLabel's translation functionality is covered with a unit test (and currently passing):

For the translator to automatically attach to the view helpers, the translator should be in the service locator. Example via config from the skeleton application:

Here is the code that pulls it out of the service locator and attaches it to the view helpers (including FormLabel):

Some things to check:

  • Confirm that the translator is set on the FormLabel helper: var_dump($this->formLabel()->getTranslator())
  • Do the translation text domains match?: var_dump($this->formLabel()->getTranslatorTextDomain())
  • Does the translation key match and exist in your DE translation file?

EDIT: Apologies, I just noticed your output of both FormRow and FormLabel together... I will set up a test here and take a look see. Thanks!

Zend Framework DevTeam

(Originally posted by: cgmartin on 09/05/12)

FormRow was not translating the label. Fixed in this PR:

Zend Framework DevTeam

This issue was ported from the ZF2 Jira Issue Tracker at

Known GitHub users mentioned in the original message or comment:
@weierophinney, @froschdesign, @cgmartin

Martin Keckeis

@weierophinney @michael-romer i think this can be closed as well. Translation for labels in formRow works.

Maks3w Maks3w closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.