Reputation: 41
I am using wordpress and WPML to make websites, and I apply reCAPTCHA under the contact form.
My website is mainly in Chinese, so the reCAPTCHA shows "I am not a robot" in Chinese. But after I duplicate the page into other languages, it still shows the wording in Chinese.
I'm wondering is there any way to change the wording of "I am not a robot" in English?
Upvotes: 1
Views: 4604
Reputation: 6277
User1121883's solution is for the old text reCaptcha v.1.0, not the modern behaviour reCaptcha. It has limited customization options now.
So if you want to change other language for other custom language page you'll need to play with reloading it with other language that would have different hl
GET parameter:
<script src="https://www.google.com/recaptcha/api.js?hl=en-GB"></script>
I've done it client-side (demo), but you may do it server-side or also use this client side code.
<button class="btn" onclick="btnclick();return false;">Load reCaptcha in Chinese</button>
<script>
function callback() { console.log("Chinese reCaptcha loaded"); }
function btnclick()
{
s = document.createElement("script");
s.src="https://www.google.com/recaptcha/api.js?hl=zh-CN";
if(s.addEventListener) {
s.addEventListener("load",callback,false);
}
else if(s.readyState) {
s.onreadystatechange = callback;
}
// we remove the inner html of old reCaptcha placeholder
var oldRecaptcha=document.getElementById('g-recaptcha');
while (oldRecaptcha.firstChild) {
oldRecaptcha.removeChild(oldRecaptcha.firstChild);
}
document.body.appendChild(s);
}
</script>
Upvotes: 3
Reputation: 1142
I am using WordPress 5+, at wp-config.php
$locale='sv_SE';
(For example, in the case of the Swedish language)
Upvotes: 0
Reputation: 6075
reCAPTCHA has a number of built in translations. You can use these by setting the lang parameter of the RecaptchaOptions:
<script type="text/javascript">
var RecaptchaOptions = {
lang : 'fr',
};
</script>
You can find more here: https://developers.google.com/recaptcha/old/docs/customization?hl=en#i18n
Upvotes: 1