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

0 comments

Leave a Reply