使用bing tranlation API翻译完整的网页 [英] translating complete web page with bing tranlation API
本文介绍了使用bing tranlation API翻译完整的网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Bing API而不是Bing小部件翻译完整的网页,因为我想为翻译面板进行自定义设计,但是我找不到任何方法,我在Azure市场上注册并获得了Key,所有示例都是为翻译文本框文本而编写的...可以给我一些帮助吗?
I'm trying to translate complete webpage using Bing API instead of Bing widget , because I want to make custom design for translation panel , but I cant find any way , I registered in Azure market place and got Key , all samples are made for translating a textbox text ... could any one please provide me some help ?
推荐答案
找到了,您必须使用此Java脚本来翻译网页
Found , you must this java script to translate webpage ,
<script src="http://www.microsoftTranslator.com/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**" type="text/javascript"></script>
<script type="text/javascript">
function translate(co) {
if (document.readyState == 'complete') {
Microsoft.Translator.Widget.Translate('en', co, onComplete);
}
}
function onComplete() {
Microsoft.Translator.Widget.domTranslator.showTooltips = false;
Microsoft.Translator.Widget.domTranslator.showHighlight = false;
Microsoft.Translator.Widget.domTranslator.showmessagebox = false;
Microsoft.Translator.Widget.showTooltips = false;
}
//You can use Microsoft.Translator.Widget.GetLanguagesForTranslate to map the language code with the language name
只需在任何onclick中发送语言代码,例如:
Just send language code in any onclick , for example :
<a href="#" id="a1" style="list-style-image: url('images/flags/ac.png');" lang="en" class="selected">English</a>
希望您会发现这很有用.
hope you can find this useful.
这篇关于使用bing tranlation API翻译完整的网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文