Jump to content

Force hCaptcha language


Recommended Posts

Just now, Marc Stridgen said:

There is nothing specific within our softwarew that will change the language used on h-captcha. We simply provide the key and secret for this

Hello @Marc Stridgen

I suppose that in the code of your application there will be the h-Captcha API to include this:

https://docs.hcaptcha.com/languages/

For example in this file (Template>core>global>forms>hCaptcha) , is it possible ?:

<div data-ipsCaptcha data-ipsCaptcha-service='hcaptcha' data-ipsCaptcha-key="{$siteKey}" data-ipsCaptcha-lang="{$lang}">
	<div class="h-captcha" data-sitekey="{$siteKey}"></div>
</div>

Many Thanks!

Link to comment
Share on other sites

But are we sure it’s not a bug? Hcaptcha should auto detect the language of the system and I can confirm that this is not working. 

If I use an hcaptcha demo site like this, the captcha is shown in German. 
But if I open the registration form of my German IPS community, everything in the captcha is shown in English. 
So, it looks like the difference is caused by IPS’ implementation. 

For now, I fixed it by changing the template. 

<div class="h-captcha" data-hl="de" data-sitekey="{$siteKey}"></div>

 

Link to comment
Share on other sites

This is actually only if you wish to enforce it for all users, which is something that would be a feature request. It should be being detected by the browser automatically. There is nothing in the software that allows for it to be forced, which is what the request was here. 

As you have been testing yourself on the automatic detection not working there, I can certainly get that reported as a bug, and have just done this

Link to comment
Share on other sites

50 minutes ago, opentype said:

But are we sure it’s not a bug? Hcaptcha should auto detect the language of the system and I can confirm that this is not working. 

If I use an hcaptcha demo site like this, the captcha is shown in German. 
But if I open the registration form of my German IPS community, everything in the captcha is shown in English. 
So, it looks like the difference is caused by IPS’ implementation. 

For now, I fixed it by changing the template. 

<div class="h-captcha" data-hl="de" data-sitekey="{$siteKey}"></div>

 

Thanks @opentype 

In which template is the modification made?

Link to comment
Share on other sites

This should already be supported because we're passing the users language while loading the JS as query parameter, so there's no need for the data-hl parameter

\IPS\Output::i()->jsFilesAsync[] = "https://js.hcaptcha.com/1/api.js?hl=" . \IPS\Member::loggedIn()->language()->short ;

But I see here 2 problems with our approach.

1. It won't return the correct language if it isn't installed. So in my case I'm expecting German, but pequeno has no German language installed, so it will return his primary installed language.

2. hcatpcha is expecting a different format than what we're returning here.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...