contact-form-7-recaptcha

Change the language of reCAPTCHA in Contact Form 7

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

16 comments

Leave a Reply

  1. jankkan · April 21, 2017

    Thank you, works like a charm!

    • janoshke · April 21, 2017

      I’m glad it helped!
      Cheers πŸ˜‰

  2. Michael Animashaun · April 21, 2017

    Thanks worked like a charm

  3. Andrea Tarricone · April 21, 2017

    Hello! Could you please make an IF/ELSE version that read the html lang= TAG and shows the assigned laguage?

    • janoshke · April 21, 2017

      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 πŸ˜‰

  4. saxotenor · April 21, 2017

    Excellent! Thanks for helping πŸ™‚

    • janoshke · April 21, 2017

      You’re welcome. Cheers πŸ™‚

  5. Aleksandra · April 21

    Thank you!

  6. javier garcia · April 21

    Thank you!

  7. Jerry · April 21

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

    • janoshke · April 21

      Sorry to hear that. If you wish to share more info please do so…

  8. Almedin · 11 Days Ago

    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.

    • janoshke · 3 Days Ago

      Hi, it is possible that the code is deprecated. I will post the update some time in near future πŸ˜‰