Some of my users experience a CSRF error in my web-application. They tell me that they don't know what to do about it.
In order to have a better user experience I would like to translate the message. Can someone tell me how I can do this?
Also, how do I actually replicate the CSRF error in my dev environment?
I am using both Symfony 2.8 and 3.0.
Remember to add your translation in a validator validator.<lang>.<type>
files (not in a message: messages
) as example:
validator.en.yml
<trans-unit id="1">
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
<target>The CSRF token is invalid. Please try to resubmit the form.</target>
</trans-unit>
EDIT - refresh cache after every change of the translation files
EDIT - test/replicate the behaviour:
You can use a tool like firebug for edit and change the _token form hidden element and submit the form OR temporally remove the field from your form.
Hope this help