Language problem with reCAPTCHA 2

Hello,

I am using Dolphin 7.3.5 and reCAPTCHA 2 is just working fine but there is a weird language issue.

The whole reCAPTCHA 2 and the word 'I am not a robot' get translated when you use the site in English or Russian. But if you have any other language like portuguese or spanish the reCAPTCHA 2 is being displayed in French. (Note: I don't have a french language installed in Dolphin and my browser is not in french either).

How to get rid of this problem and display the reCAPTCHA 2 in any other installed language other than English and Russian?

It's Urgent because how will people join the site if they can't even understand what the reCAPTCHA 2 is asking them to do?

Thanks.

Quote · 9d ago

Any idea to make the reCAPTCHA 2 to detect any other language insalled on the site different from English and Russian only? Or to force it to display in a specific language only (e.g. The default language)

Thanks

Quote · 8d ago

I've managed to fix this issue by changing:

$this->_sApiUrl = 'https://www.google.com/recaptcha/api.js';

to

$this->_sApiUrl = 'https://www.google.com/recaptcha/api.js?hl=xx-XX';

in templates/base/scripts/BxBaseCaptchaReCAPTCHA.php

xx-XX is the language code. e.g: es-ES, pt-PT etc.

it's a workround that force the ReCAPTCHA to be displayed in the specified language. It helps but it also creates another problem. The ReCAPTCHA will always be diplayed in that language no matter how you switch the language on the website. I am satisfied with it since English is not the main website language of this new project that I started.

I would like to ask the Boonex Team to consider going into this problem and provide a final fix. ReCAPTCHA only get translated in the languages packed in Dolphin (English and Russian). When the user (admin) create/add a another language, the ReCAPTCHA is displayed in french.

Regards

 

Quote · 7d ago

I would guess that since the recaptcha is coming form google - that is where the translation issues need to be discussed.

caredesign.net
Quote · 7d ago

Hi ProfessorSr,

Thanks for your reply. Well, I don't think so because the ReCAPTCHA auto-detects languages packed with Dolphin (English and Russian). It only doesn't detect any other language manually added/created by the admin after Dolphin installation. Maybe English and Russian have some code built-in Dophin (in the core) that make them to be detected the ReCAPTCHA. I am just guessing!

To get the ReCAPTCHA detect any other custom language you have to force it using the piece of code in the API Url as mentionned in my previous post.

Quote · 7d ago

i have looked up your issue and it is not just with Dolphin - thus, it is not a Dolphin issue - it is a recaptcha issue. Your solution is one solution that was listed as it is what determines from Google what language to use. So again, the issue is not with Dolphin, but with recaptcha.

 

you could probably add a script that checks for the browser language and then uses the correct language identifier for recaptcha. Thats what I have found that others are doing.

caredesign.net
Quote · 7d ago

It maybe the code for your language isn't properly set in the database (sys_localization_languages table), if it's set correctly then try the following modification in templates/base/scripts/BxBaseCaptchaReCAPTCHA.php file near ~80 line, replace:

$aApiParams['hl'] = getCurrentLangName(false);

with

$aLang = bx_lang_info();
$aApiParams['hl'] = isset($aLang['LanguageCountry']) ? $aLang['LanguageCountry'] : getCurrentLangName(false);

Make sure that LanguageCountry field in sys_localization_languages table is set correctly for your language.

Please let us know about the result, if it help we'll apply this fix in the next version update.

Rules → http://www.boonex.com/terms
Quote · 6d ago

Hello AlexT,

Thanks for your reply and sorry for the delay to respond to you. You are a genius. It works perfectly. Thank you so much.

I did check, indeed, the language code was properly set in the database (in the sys_localization_languages table). I removed my modification made while trying to fix this issue, then I applied the code change you provided. Everything was fixed. Beside English and Russian,  the ReCAPTCHA now auto-detects any other language installed in Dolphin. Your fix is far better than my workaround mentionned in my previous post because the ReCAPTCHA now switches the language when the site language changes which wasn't the case with my workaround.

Once again, thanks a lot for providing a solution. Yeah, it sounds great to apply this fix to the next version update.

Regards

Quote · yesterday
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.