translating complete web page with bing tranlation API

谁都会走 提交于 2020-01-06 07:15:36

问题


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 ?


回答1:


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

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.



来源:https://stackoverflow.com/questions/26990932/translating-complete-web-page-with-bing-tranlation-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!