Would you like to customize the language of Google’s v2 reCAPTCHA on your forms? While Google attempts to auto-detect your page’s language, sometimes you may need to manually set it.
This guide will show you how to set a specific language for your reCAPTCHA using a simple code snippet.
Setting the Language
To set a specific language for your reCAPTCHA, add this code to your site. For help adding code snippets, please see this tutorial on adding custom PHP or JavaScript.
This code works by:
- Intercepting the reCAPTCHA URL before it loads
- Adding the language parameter (‘hl’) with your specified language code
- Returning the modified URL with proper escaping for security
To use a different language:
- On line 10, replace ‘fr‘ with your desired language code
- Find your language code in Google’s documentation on reCAPTCHA Language Codes
After adding the code, the reCAPTCHA text (like “I’m not a robot“) will appear in your chosen language.
Multi-Language Support
For sites using WPML, you can use this alternative code that automatically matches your WPML language settings:
And that’s all you need to force the reCAPTCHA language. Would you like to also change the look of reCAPTCHA? Take a look at our article on How to Change the Captcha Theme on Google Checkbox v2 reCAPTCHA.