Translating your validation messages errors in ZF2
This is a pretty nice tip that helps you to use the ZF2 languages files to translate the validation messages in the form.
With your translations settings previously added, you need to use a ZF2 Form View Helper - http://goo.gl/r2JDBB - in the form view to define wich language to use, based on your text_domain.
$this->formElementErrors()->setTranslatorTextDomain(__NAMESPACE__);
Now you can change your validation messages on your language files on the folder:
/vendor/zendframework/zendframework/resources/languages
Written by Daniel Salvagni
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Form
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#