<![CDATA[ ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language - MODX Community Forums]]> https://forums.modx.com/thread/?thread=103885 <![CDATA[ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language]]> https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558724

reCaptcha v2 with Formit and Modx 2.6.3

Seams to work fine for me, and does not fires errors in the log from it but there's not a correct language detection.
Using 2 contexts (web = FR, EN = english) the text 'I'm not a robot' is always in the default language (French') ' Je ne suis pas un robot'. Even if I'm on may english side contact form.

the rendered html code in the Google iFrame show lang='fr'
`html dir="ltr" lang="fr"`

The [[++CultureKey] at this moment is however correct and set to 'en' ...?

Thank you]]>
elz064 May 25, 2018, 07:08 AM https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558724
<![CDATA[Re: ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language]]> https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558859
Is Sepiariver still involved into its add-on.


Did not get any reply here or on its github issues panel
:-(]]>
elz064 Jun 01, 2018, 07:19 AM https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558859
<![CDATA[Re: ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language]]> https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558734 seen here

Taken from Google:
hl: Forces the widget to render in a specific language. Auto-detects the user's language if unspecified.]]>
iusemodx May 25, 2018, 01:36 PM https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558734
<![CDATA[Re: ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language]]> https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558729 Quote from: iusemodx at May 25, 2018, 11:15 AM
Then it's obviously different to how we use it in Evo

Might be beneficial to get the snippet developer to add a language option to the call

This might also be of interest

That's for Revo.
and the companion snippet "recaptchav2_render" is supposed to do the job:

$lang = $modx->getOption('cultureKey', null, 'en', true);
// use 'recaptchav2_invisible_html' inside form element for invisible recaptcha
$tpl = $modx->getOption('tpl', $scriptProperties, 'recaptchav2_html', true);
$form_id = $modx->getOption('form_id', $scriptProperties, '');

$recaptcha_html = $modx->getChunk($tpl, array(
    'site_key' => $site_key,
    'lang' => $lang,
    'form_id' => $form_id,
    ));

if ($hook) { 
    $hook->setValue('recaptchav2_html', $recaptcha_html); // This won't re-render on page reload there's validation errors
    return true;
} else { // This works at least
    return $recaptcha_html;
}

So puzzling.]]>
elz064 May 25, 2018, 11:38 AM https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558729
<![CDATA[Re: ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language]]> https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558727
Might be beneficial to get the snippet developer to add a language option to the call

This might also be of interest]]>
iusemodx May 25, 2018, 11:15 AM https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558727
<![CDATA[Re: ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language]]> https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558726 Quote from: iusemodx at May 25, 2018, 07:30 AM
I don't know if it will help you, but adding the language to the javascript call will change the language, see documentation

Example:

From this
<script src="https://www.google.com/recaptcha/api.js" async="" defer=""></script>


To this
<script src="https://www.google.com/recaptcha/api.js?hl=en" async="" defer=""></script>


Language codes can be found here

Well, that could be a hint if I was using the native Google stuff, but this is the ModX Extra:
https://github.com/sepiariver/recaptchav2/issues/28

So I have no control on the Js insertion into the dom. (unless, I guess, I hack the recaptchav2 snippet)..
]]>
elz064 May 25, 2018, 08:46 AM https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558726
<![CDATA[Re: ReCaptchaV2 + Formit, language issue : I'm not a robot txt always default context language]]> https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558725 documentation

Example:

From this
<script src="https://www.google.com/recaptcha/api.js" async defer></script>


To this
<script src="https://www.google.com/recaptcha/api.js?hl=en" async defer></script>


Language codes can be found here]]>
iusemodx May 25, 2018, 07:30 AM https://forums.modx.com/thread/103885/recaptchav2-formit-language-issue-i-039-m-not-a-robot-txt-always-default-context-language#dis-post-558725