Jump to content

Localization for google recaptcha in contact form


LesGiroiseaux

Recommended Posts

Good morning everyone,

I would need your help to configure this option.

I am not a prestashop developer, but a software programmer in other domains, so I can follow technical suggestions :). 

I was able by following suggestions in the forum to add the Google recaptcha v2 to my website, and it works properly.

I am using Prestashop 1.6.24

What I did is 

- include in header.tpl the following code, specifying the language "French" as default

<script src='https://www.google.com/recaptcha/api.js?hl=fr'></script>

- add the recaptcha module in contact_form.tpl as follows

<div class="g-recaptcha" data-sitekey="MY_PERSONAL_SITE_KEY"></div>

and finally, I check for a valid captcha in ContactController.php.

My problem is that my website is available in 4 languages, and the captcha is always shown in the language I select at the beginning.

I see that in the contact_form.tpl module, the text is modified depending on the selected language (informations like "Send a Message", "Order reference" and so on), so my question is: would it be possible to modify the captcha language parameter dynamically from contact_form.tpl? Or, would it be possible to do so already in header.tpl (I assume that the user already has its language configured)? How could I obtain the language information at this stage?

Thanks to everyone willing to help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...