Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Zend\Form\Element\Submit and i18n #113

Open
adrianilie9 opened this issue Aug 31, 2016 · 1 comment
Open

Zend\Form\Element\Submit and i18n #113

adrianilie9 opened this issue Aug 31, 2016 · 1 comment

Comments

@adrianilie9
Copy link

The "value" attribute of a \Zend\Form\Element\Submit gets translated twice.

Take for example the code below:

$submit = new \Zend\Form\Element\Submit('Submit', array());
$submit->setAttribute('value', 'Sign in');

At this point, if i render the element, the "Sign in" value will get translated, all good. However, after the POST has been sent, in my controller i prepare to perform the validation:

$data = $this->params()->fromPost();
$form->setData($data);

After calling setData(), the already translated "Sign in" will try to get translated again.

This is generally not an issue, however in my implementation if a \Zend\I18n\Translator\Translator::EVENT_MISSING_TRANSLATION is triggered, the unknown string will be added to the PO language file, which kinda messes it up, because you now have strings from different languages into the same language file.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at laminas/laminas-form#25.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants