Change the language of reCAPTCHA in Contact Form 7

contact-form-7-recaptcha

This issue is resolved long time ago and for those who are using one of the best WordPress plugin called Contact Form 7 and didn’t read the developer’s post on the topic, here is how to change the language of reCAPTCHA.

In this example I’m using the French (Canadian) language and the text that Google reCAPTCHA displays in English as “I’m not a robot” needs to be displayed in French. Here is the very simple solution for this:

1. Edit the functions.php file

Locate the file functions.php in your theme folder (or child theme) and add the following code at the end:

add_action( 'wpcf7_enqueue_scripts', 'custom_recaptcha_enqueue_scripts', 11 );

function custom_recaptcha_enqueue_scripts() {
	wp_deregister_script( 'google-recaptcha' );

	$url = 'https://www.google.com/recaptcha/api.js';
	$url = add_query_arg( array(
		'onload' => 'recaptchaCallback',
		'render' => 'explicit',
	 	'hl' => 'fr-CA' ), $url );

	wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
}

Note that the fr-CA is the language code for French (Canadian) so you must change it according to your needs and the list of supported language codes can be found here

By janoshke

Web developer and IT consultant. Freelancer with full respect for OpenCart and WordPress. Gamer, (ex)drummer and parent.

20 comments

    1. Thanks for the comment, but this is something Google programmers should do. I’m sure they will make this multilanguage work in near future.
      Cheers πŸ˜‰

  1. This does not work for me. Recaptcha language stays english even after function.php edit and restart apache2 + browser.

  2. Hi, this code does not work anymore. Now Really Simple Captcha work with google reCaptcha v3. Are you able to modify this code for new reCaptcha version. Thanks.

Leave a Reply