Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zend\Form\Element\Submit and i18n #25

Open
weierophinney opened this issue Dec 31, 2019 · 0 comments
Open

Zend\Form\Element\Submit and i18n #25

weierophinney opened this issue Dec 31, 2019 · 0 comments

Comments

@weierophinney
Copy link
Member

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.


Originally posted by @adrianilie9 at zendframework/zend-form#113

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

No branches or pull requests

1 participant