Sunday, 18 August 2013

Bing Translator Widget Custom Button

Bing Translator Widget Custom Button

I can't seem to get the bing translator widget to call with a custom
button. Here is a simple version of the code that I need.
<html>
<head>
<script
src="http://www.microsoftTranslator.com/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**"
type="text/javascript"></script>
<script>
fuction translateThis()
{
Microsoft.Translator.Widget.Translate('en', 'es', onProgress,
onError, onComplete, onRestoreOriginal);
}
//You can use Microsoft.Translator.Widget.GetLanguagesForTranslate to map
the language code with the language name
function onProgress(value) {
document.getElementById('counter').innerHTML = Math.round(value);
}
function onError(error) {
alert("Translation Error: " + error);
}
function onComplete() {
document.getElementById('counter').style.color = 'green';
}
//fires when the user clicks on the exit box of the floating widget
function onRestoreOriginal() {
alert("The page was reverted to the original language. This
message is not part of the widget.");
}
</script>
</head>
<body>
<button onClick="translateThis()">Click This</button>
Here is some other stuff to translate...
</body>
</html>

No comments:

Post a Comment