Asp.net MVC recaptcha set language not working - asp.net

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>

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.

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

Related

Language Translation in ASP.NET

I have a website in ASP.NET which will be used globally. There is a requirement to provide a language translation option at the home page where the user will be able to select a language and the page(s) will be rendered in that. I have heard of Google translation service but have no idea how to use them. Can anyone provide some links/suggestion that can guide me in this?
Regards.
Follow the instructions here and you'll be good to go, but essentially, all you need to do is include this code:
<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Into every page that you want to allow the user to be able to translate.

PHP and a google translator API alternative

Since Google is going to pull the plug out of their translator API (by the end of this year), Is there someone who already found a good (free or $) alternative?
Try TranslateThis on http://translateth.is/...
Is very simple! To see the effects try this piece of code:
<!-- Begin TranslateThis Button -->
<div id="translate-this"><a style="width:180px;height:18px;display:block;" class="translate-this-button" href="http://translateth.is/">Translate</a></div>
<script type="text/javascript" src="http://x.translateth.is/translate-this.js"></script>
<script type="text/javascript">
TranslateThis();
</script>
<!-- End TranslateThis Button -->
Don't worry about the button aspect... You can customize it!
Google is offering and alternative to website translation. Its the GOOGLE WEB ELEMENTS, and some code from the google's web elements homepage itself for translation
<!-- Google Translate Element -->
<div id="google_translate_element" style="display:block"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: "af"}, "google_translate_element");
};</script>
Other alternatives:
Microsoft Translation Tools
they offer HTTP, SOAP and SDK interfaces for integration.
If you need just language detection, there is free API:
http://detectlanguage.com
It produces JSON output, just like Google Translate.

Can I translate my website with Google Translate?

I have a web page created in English. Depending on the
continent, I want to dynamically translate my whole webpage to another
language.
The webpage is fairly complex, so I cannot do it string by string. I just want to do it in a way like at the time of loading it will get translated into desired language.
Can I translate my webpage using the Google Translate API?
Here is an example to to add Google translator to web page to translate specific element:
<html>
<head>
<title>My Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="translate">Тестирование</p>
<div class="translate_control" lang="en"></div>
<script>
function googleSectionalElementInit() {
new google.translate.SectionalElement({
sectionalNodeClassName: 'translate',
controlNodeClassName: 'translate_control',
background: '#f4fa58'
}, 'google_sectional_element');
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleSectionalElementInit&ug=section&hl=en"></script>
</body>
</html>
http://jsfiddle.net/maxim75/H3Wkr/ - working example
You could add a Google Translate widget to you page and users can translate to their language of choice on demand. http://www.google.com/webelements/#!/translate
By visiting google translate tool it generate a code that you add in your website.
It's also possible directly by using a url
http://www.google.com/translate?sl=XX&tl=YY&u=http://www.trial.com
where xx is the original language, yy the language to translate...
Maybe my tutorial will be helpful: google translate.
Yes, you can. See Google Translate API documentation here: http://code.google.com/apis/language/translate/v2/getting_started.html
Note that automated machine translation is, as of 2011, not an adequate match for human translation, so don't expect that the translated text will be perfect - it will probably be understandable with effort, but it will be obvious that it's machine-translated.
Probably you can use microsoft translator API.. you can find the implementation at
http://code.google.com/p/micrsoft-translator-php-wrapper/
and you can see the demo also
http://renjith.co.in/translate/

Is ASP.NET (webforms) Incompatible with Google Website Optimizer Multivariate Testing?

I've been stuggling all morning trying to get a multivariate test going in google website optimizer.
I've copy and pasted the header/footer code into the pages, and setup a basic page section just to see that everything is working.
When I try to validate the code its failing saying
"No sections detected on test page
TestSectionName - Unexpected or missing characters - Line: 422 Expected: </noscript>"
The silly thing is that the output is clearly there (I have used an asp literal to get around the asymetric noscript tag) and can clearly see it in the source as follows:
<script>utmx_section("TestSectionName")</script><h1>Buy This Product!</h1></noscript>
I've already tried disabling/removing the existing google analytics code in the site on the off chance that was conflicting with it with no luck.
I think there might be some incompatibility with the asp.net framework and this WSO framework. I was able to use exactly the same code saved into a raw html file with no asp.net/page content and have it validate ok.
e.g.
<html><head></head><body>
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='xxxxx',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return c.substring(i+n.
length+1,j<0?c.length:j)}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
</script>
<!-- End of Google Website Optimizer Control Script -->
<script>utmx_section("TestSectionName")</script><h1>Buy This Product!</h1></noscript>
<!-- Google Website Optimizer Tracking Script -->
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
(document.location.protocol=='https:'?'s://ssl':'://www')+
'.google-analytics.com/ga.js"></sc'+'ript>')</script>
<script type="text/javascript">
try {
var gwoTracker=_gat._getTracker("UA-xxxxx-1");
gwoTracker._trackPageview("/xxxxx/test");
}catch(err){}</script>
<!-- End of Google Website Optimizer Tracking Script -->
</body>
</html>
After all of this I am wondering if there is
a) anyone out there using asp.net with multivariate testing successfully
b) a known incompatibility with something in asp.net
c) known "donts" when it comes to coding with WSO multivariate testing
d) something really obvious I am missing?
I have used Google Website Optimizer multivariate tests on an ASP.NET website without any problem.
Have you tried putting </noscript> on its own line? I think I always put it on a blank line after the default section.

how we can i use google translator api in my website

Well I want to use Google api translator in my website and when I am putting this api code in my html page it's working fine.
----------------------------------google translator code :-----------------------------
<div id="google_translate_element" ></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
I want to put the code in when I am putting this code in iframe then it shows everything.
But while changing the language it changes the language of elements in the iframe it doesn't affect outside the iframe.
I guess this is why the iframe tag is used to include an external document into an existing one.
Google Translator will translate the content of the iframe only, since it has no clue about the container document.
Please see also:
http://forums.macrumors.com/showthread.php?t=467248

Resources