12

Is it me or is recaptcha images cannot be translated to another language other than EN? I have enter image description here and it is still in English. Is this intentional?

6 Answers 6

34

For reCAPTCHA 2. Since a while have passed

This is your link to cdn look at the end, hl parameter

<script src="https://www.google.com/recaptcha/api.js?onload=myCallBack&render=explicit&hl=fr" async defer></script>

This is your captcha inside the form

<div id="recaptcha1"></div>

This is your javascript you can specify the lang code here too, I assume one of them is enough

var recaptcha1;
var myCallBack = function() {
    //Render the recaptcha1 on the element with ID "recaptcha1"
    recaptcha1 = grecaptcha.render('recaptcha1', {
    'sitekey': '6LdJLws_your site key',
    'lang' : 'fr'
   });};

You can add multiple reCAPTCHAs with this method.

Here is full language reference: https://developers.google.com/recaptcha/docs/language?hl=en

6
  • 1
    This solution works fine. Please refer here for the Language codes Oct 6, 2015 at 19:11
  • Worked for me, I only needed to add the param hl=fr in the script tag call. Thanks ! May 19, 2017 at 9:17
  • First tried with the 'lang' : 'bn', din't work for me. Then tried with the &hl=bn worked nicely. Oct 26, 2020 at 15:02
  • 1
    @DanielDanielecki I checked the documentation and it is not really clear how.
    – atilkan
    Nov 16, 2020 at 15:19
  • 1
    @atilkan it's not clear to me as well, was hoping that maybe you'll know. Thanks for checking, +1 for it :) Nov 17, 2020 at 15:14
17

Just to minimize the answers above.

It's not necessary to additionally add another <script> saying the same as you already do with your html (reCAPTCHA) element. Changing the link of the API will also work.

<script src="https://www.google.com/recaptcha/api.js?explicit&hl=nl"></script>

For me I've changed the language code to nl(dutch) after &hl=. But you can find your own language code at: https://developers.google.com/recaptcha/docs/language

1
8

replace lang to hl and it'll work:

<script type="text/javascript">
var recaptcha1;
var myCallBack = function() {
    //Render the recaptcha1 on the element with ID "recaptcha1"
    recaptcha1 = grecaptcha.render('recaptcha1', {
        'sitekey': '6LdJLws_your site key',
        'hl' : 'fr'
    });
};
</script>
7

For recapture 2 just add script file with your language:

<script src="https://www.google.com/recaptcha/api.js?hl=fr" async defer></script>

Language codes here: https://developers.google.com/recaptcha/docs/language

3

You just have to add this function above to your theme's function.php file and all done. It really works for me, you can change translation language by modifying country code in hl parameter.

Here i'm using es here for Spanish translation.

This is a list of language country codes: https://developers.google.com/recaptcha/docs/language

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

    $url = 'https://www.google.com/recaptcha/api.js';
    $url = add_query_arg( array(
        'onload' => 'recaptchaCallback',
        'render' => 'explicit',
        'hl' => 'es'), $url ); // es is the language code for Spanish language

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

add_action( 'wpcf7_enqueue_scripts', 'wptricks24_recaptcha_scripts', 11 );
1
  • Just open the functions.php file of your current theme and paste the below mentioned code, you can modify it to any of the language, just look at the above code we are using ‘hl’ => ‘es’ where “es” is the language code for Spanish language. We can create this recaptcha with few more languages at a time by applying the conditions to the code. We just need to pass the language code of our choice to “hl” parameter. Apr 12, 2017 at 7:56
-1

Look at this page, rolling down and you will get the answer : https://developers.google.com/recaptcha/docs/customization

On your page where you show up the captcha for clients, within the <form> and before the reCaptcha widget, you add this code :

<script type="text/javascript">
var RecaptchaOptions = {
   lang : 'fr',
};
</script>

The following languages are supported:

English en / Dutch nl / French fr / German de / Portuguese pt / Russian ru / Spanish es / Turkish tr

Hope it helps you...

3
  • I did that but the "stop spam" is an image and not a text. It's not translated eventhough lang = fr
    – gerl
    Sep 26, 2013 at 18:29
  • 1
    I could not install reCaptcha for my existing form (without plugin), there was no explication and it was too much for my php knowledge, also you say that you can not change the language... so, try this one, i use this one now, you will noy have problem with the language : link Sep 26, 2013 at 22:09
  • The doc page not exists, and the RecaptchaOptions not working. Nov 30, 2016 at 19:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.