Introduction
Would you like to use WPML or Polylang to change validation messages on your forms? In WPForms, these messages are displayed inline, and fields are validated on the fly using PHP. These messages can be easily changed inside your WPForms Settings but if you have a multi-lingual site, you may need to have these changed based on the language that the user is currently using.
When you need to provide multiple different language translations, these messages need to be conditionally different.
With that in mind, there is a filter that can be used to check the language your visitor currently is using. That filter is ICL_LANGUAGE_CODE
. Using this filter means that if you’re using WPML or Polylang for your WordPress translations, you can check what the current language on your site is set to.
We can use this filter to check and see if the validation message should be changed.
Each code example is going to show you the French and Spanish translations, you’ll need to adjust each code snippet for your correct language as well as the translations.
Remember you’ll need to add the correct code snippets to your site before you will see any changes.
If you need help in adding code snippets to your site, please review this tutorial.
Changing the standard required field message
Below is an example that changes the required field validation message depending on the language WPML is currently set to.
Changing the other validation messages
For a complete code snippet for all of the validation messages, you would use this code.

And that’s it! You can now successfully change the validation messages. Would you like to change the date picker strings to match the language as well? Take a look at our article on How to Modify Date Field Date Picker Strings.
Related
Action Reference: wpforms_wp_footer_end
Filter Reference: wpforms_frontend_strings