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)
Output incorrect: "username", even if translation available
Output correct: "Benutzername" (DE translation of "username")
(Originally posted by: froschdesign on 09/04/12)
Code tags added.
(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:
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!
FormRow was not translating the label. Fixed in this PR:
This issue was ported from the ZF2 Jira Issue Tracker at
Known GitHub users mentioned in the original message or comment:
@weierophinney, @froschdesign, @cgmartin
@weierophinney @michael-romer i think this can be closed as well. Translation for labels in formRow works.
@Maks3w ping - close pls.
See here translation: https://github.com/zendframework/zf2/blob/master/library/Zend/Form/View/Helper/FormRow.php#L126-L133