Microsoft Translator use example on Azure

Source: Internet
Author: User

Recently looking for an API to translate, search for this MS API;

Toss a bit, here to record the use of the method, because many examples on the internet is the old version (V1), does not apply at all;

Now it is said that the new version of the V2, the latter version is not universal, temporarily unable to know;


1 Register an account, if you already have an account with MS to register here: Https://datamarket.azure.com/account; After successful login, return to this page;

Click Edit below to look like this:


Remember, country do not choose China, otherwise this API will suggest that your market is not available, that is, before the choice of China, can not be used, then, to change into other countries here can be used;

, but the following language options are irrelevant;



2 Open this API, click on the account data, or enter the above translator search is OK;




3 Click on the Translator link to complete the subscription. Go back to this list to see that you are subscribed to the status, the following will appear the "Use" button, you can directly click on it to try it, it will give the API all supported features of the demo;

Trial interface


4 Creating an App

Go to App Management


Click to register the app, for the later use, only those two items are needed;


5. External trial API, save the following code to xxx.htm;

<form method= "POST" action= "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13" enctype= "application/ X-www-form-urlencoded "target=" KKK "><input name=" Grant_type "value=" client_credentials "/><input name=" client_id "value=" Chrome-translates-plugin "/><input name=" Client_secret "value=" WmxiM= "/><input name=" Scope "value=" http://api.microsofttranslator.com "/><input type=" Submit "/></form>text <input id=" Text "value=" text "/>accesstoken <input id=" at "value=" "/><input id=" Get "type=" button "value=" Get "/>& Lt;iframe id= "KKK" name= "KKK" src= "About:blank" width= "100%" height= "All" ></iframe><script type= "text/ JavaScript "> document.getElementById (' Get '). onclick = function () {var to =" Zh-chs ", Text =            document.getElementById (' text '). Value;            var s = document.createelement ("script");               S.SRC = "Http://api.microsofttranslator.com/V2/Ajax.svc/Translate" + "? Appid=bearer" + encodeURIComponent (document.getElementById (' at '). Value) + "&to=" + encodeuricompone            NT (TO) + "&text=" + encodeuricomponent (text) + "&oncomplete=mycallback";        Document.body.appendChild (s);        } function Mycallback (response) {Console.log (response); } </script>


Use your browser to open xxx.htm, fill in the app's client ID and Client Secret, click Submit, return, put Accesstoken fill, text input to translate, click Get can see the results in Console.log, there is need to change console.log to alert; According to this process, you can write other ways of using it;




Judging from this, I didn't find the function I wanted:

1 No word phonetic transcription;

2 the sound without words;

3 There are no related interpretations, such as nouns, verb plural


So, used to do translation can also, but look up the word is too little function;


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Microsoft Translator use example on Azure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.