We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36604
    • 268 Posts
    Hi,


    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
      • 13226
      • 953 Posts
      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
        • 36604
        • 268 Posts
        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)..
          • 13226
          • 953 Posts
          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
            • 36604
            • 268 Posts
            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.
              • 13226
              • 953 Posts
              V2 doesn't use "lang" it uses "hl" as seen here

              Taken from Google:
              hl: Forces the widget to render in a specific language. Auto-detects the user's language if unspecified.
                • 36604
                • 268 Posts
                Up

                Is Sepiariver still involved into its add-on.


                Did not get any reply here or on its github issues panel
                :-(