Jump to content

Featured Replies

Posted

Hello, hCaptcha doesn't show my language correctly in the website.

How to force the language in h-captcha?

Thanks.

Solved by Marc

Go to solution
  • Community Expert

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

  • Author
 

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!

  • Community Expert

That is very likely. You would however need to post up a suggestion in our suggestions area if you wish to see something to directly set that. At present there isnt anything to directly set that option

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>

 

  • Community Expert

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

  • Author
 

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?

  • Community Expert

Global->Forms->hcaptcha would be the one being looked at there

  • Author
 

For now, I fixed it by changing the template. 

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

 

Perfect!

Solve the language issue.

  • Community Expert

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.

  • 2 months later...
  • Community Expert
  • Solution

This has now been resolved in the latest release (4.7.2). Please update to this version to resolve the problem. If you are still experiencing the issue after upgrade, please let us know.

Recently Browsing 0

  • No registered users viewing this page.