danarj
danarj

Reputation: 1838

Asp.net MVC recaptcha set language not working

I have create a recaptcha plugin and I wanted to change language from english to other languages (france, spanish or arabic) but it does not work it only change it if I visited (france, spanish or arabic) version of google and I have set:

<script>
     var RecaptchaOptions = {
     'theme': 'red',
     'lang': 'ar'
     };

</script>

in various places (before and after recaptcha) in my code but no luck my recaptcha html element:

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

Upvotes: 0

Views: 1512

Answers (2)

Nelson Martins
Nelson Martins

Reputation: 57

Hello fellow human, just attach this code to end of view file:

<script src="https://www.google.com/recaptcha/api.js?onload=myCallBack&render=explicit&hl=pt" async defer>
</script>

- "pt", it's code language to change if you need the language codes: https://developers.google.com/recaptcha/docs/language

Upvotes: 0

MaxRev17
MaxRev17

Reputation: 393

Where you include the script on the page try appending hl={language} to the query string (as below).

<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=your_public_key&hl=fr" />

I found this answer on https://groups.google.com/forum/#!topic/recaptcha/o-YdYJlnRVM

Hopefully this can help you, although be aware that the recaptcha should automatically translate so you may not need to do this.

Upvotes: 3

Related Questions