Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are trying to translate the Google reCAPTCHA from English to Arabic on your website but are unsure how to proceed since WPML does not handle the translation of external services like Google reCAPTCHA.
Solution:
The language of the Google reCAPTCHA widget is controlled by Google's API parameters. Since this widget is embedded directly into your theme's template files and not managed by a plugin or Elementor, you will need to adjust the API call to specify the desired language. This involves modifying the src attribute in the reCAPTCHA iframe to include the language parameter. For example, to set the language to Arabic, you can modify the src URL as follows:

<iframe src="https://www.google.com/recaptcha/api2/anchor?hl=ar"></iframe>

Please note that this solution might be outdated or not applicable to your specific case. If this does not resolve your issue, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket with us.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 9 replies, has 1 voice.

Last updated by davidW-132 5 days, 21 hours ago.

Assisted by: Bruno Kos.

Author Posts
September 15, 2025 at 3:18 pm #17403212

davidW-132

Background of the issue:
I'm trying to translate the English captcha box to Arabic on my site hidden link. The English version of the captcha is shown in this image: hidden link, and the Arabic version is shown here: hidden link. The live URL for this is hidden link (Click 'create new account' to see the versions).

Symptoms:
I don't know how to translate the captcha box from English to Arabic.

Questions:
How can I translate the captcha box from English to Arabic using WPML?

September 15, 2025 at 3:23 pm #17403252

davidW-132

I have also tried searching for the string 'I'm not a robot' to identify the captcha - but I can't find it.

September 16, 2025 at 5:12 am #17404248

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

There are two ways CAPTCHA text can work on the site:

1. If the site uses an external service such as Google reCAPTCHA, hCaptcha, or Cloudflare Turnstile, the text comes from that service. It usually changes automatically based on the visitor’s browser language, not WPML, so it is not possible to translate it.

2. If the CAPTCHA is part of a plugin like Contact Form 7, WPForms, or Really Simple CAPTCHA, the static text (for example, “Enter the text”) can be translated with WPML. The random code itself is always the same.

Could you let me know which CAPTCHA system the site is using so I can confirm how the translations will work?

September 16, 2025 at 7:20 am #17404448

davidW-132

Hi Bruno, could I give you the login credentials and you can take a look?

September 16, 2025 at 11:36 am #17405944

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I marked your next reply as private so that you can safely add credentials.

September 17, 2025 at 6:43 am #17408188

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

That is a Google reCAPTCHA iframe. The src attribute points to hidden link?..., which is the official Google reCAPTCHA service.

The reCAPTCHA widget’s language is controlled by Google’s API parameters and from what I see, you don't have a plugin for this, it is not even part of the Elementoror template for this page hidden link, this is all coded directly into the theme template files (function call for the reCAPTCHA).
hidden link

WPML (or any other multilingual plugin for that matter) can translate your site’s content, but they do not translate the Google reCAPTCHA widget itself.

2725fe9c-79e4-4c9b-97e7-23af29e75187.png
September 17, 2025 at 8:28 am #17408413

davidW-132

Hi Bruno thanks for this. The issue is that the captcha does not appear on the arabic version - it disappears - is this something to do with how the child theme is translated at all?

September 17, 2025 at 12:10 pm #17409341

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I see that on arabic there is a "window.onload_recaptcha_callback is not defined. Check functions.php for reCAPTCHA script enqueue and inline script." error recorded in the console.

That error usually happens when reCAPTCHA is being loaded twice (once by default, once by your code) or when WPML changes the page language, but the onload callback is not defined before reCAPTCHA tries to run. In this case it is likely the later.

Is it all coded here?
hidden link

I guess it is like this?

<?php if ( ! empty( $recaptcha_site_key ) ) : ?>
    <div id="recaptcha-login-container"
         class="g-recaptcha"
         data-sitekey="<?php echo esc_attr( $recaptcha_site_key ); ?>"
         data-callback="recaptcha_login_callback">
    </div>

    <input type="hidden"
           name="recaptcha_response_login"
           id="recaptcha_response_login">
<?php endif; ?>

Maybe something like this could work (add all of this into the functions.php):

function add_recaptcha_callback_script() {
    ?>
    <script>
        function recaptcha_login_callback(token) {
            // Save the token into hidden field
            document.getElementById('recaptcha_response_login').value = token;
        }
    </script>
    <?php
}
add_action('wp_footer', 'add_recaptcha_callback_script');

function load_recaptcha_with_language() {
    if ( defined('ICL_LANGUAGE_CODE') ) {
        $lang = ICL_LANGUAGE_CODE; // WPML language code (e.g. ar, en, fr)
    } else {
        $lang = 'en'; // fallback
    }

    wp_enqueue_script(
        'google-recaptcha',
        '<em><u>hidden link</u></em>' . esc_attr($lang),
        array(),
        null,
        true
    );
}
add_action('wp_enqueue_scripts', 'load_recaptcha_with_language');

But this is just a possible theory. Given that all this is coded directly into the theme, so quite a lot of custom code which we don't support according to our support rules, can you check with developers of the theme about this?

Let me know what they say, in case they are unable to resolve it.

error captcha.jpg
September 17, 2025 at 12:18 pm #17409361

davidW-132

Bruno - thank you so much for these suggestions! I'm putting them to the developer of the pages / survey in question - hopefully they will be able to work from your suggestions and make appropriate edits. Thanks again.

September 17, 2025 at 1:19 pm #17409890

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I’m glad to hear the suggestions are with the developer. They should serve as a solid starting point, though some adjustments may be required depending on the setup. If any clarification or further support is needed during implementation, please let me know.

September 20, 2025 at 11:57 am #17418226

davidW-132

Hi Bruno, developer was able to work with your suggestions and has now edited the pages so that the captcha can be included. Many thanks for all your help.