I have always liked to use the Google Translate API for online translation, but later, as everyone knows, Google's services are getting slower and slower, and I can't stand it. I use SOAP as an example, hoping to give some reference to the little friends who have the same needs. The old birds don't need to read it, and there is no technical content.
As shown in the figure above, click "Developer", click "Add", enter the basic information, wait for a while, refresh the page, you will see an Application ID, write it down.
Then go to the MSDN documentation
http://msdn.microsoft.com/en-us/library/dd576287.aspx
Just write the code according to the document. Let me take SOAP as an example to write a simple translation program.
Create a new application in VS2010 (or desktop program or console or website),
Right-click the application, click " Add Service Reference ", enter
http://api.microsofttranslator.com/V2/Soap.svc
Click "Go" and click on the service to view related operations and methods
Then enter a namespace like ServiceReference1 below
Click OK, as shown below:
Then add two richTextBoxes on the form, add a button button, and write in the click event
1 string result; 2 ServiceReference1.LanguageServiceClient client = new ServiceReference1.LanguageServiceClient(); 3 result = client.Translate("前面申请到的APPID", richTextBox1.Text, "en", "zh-CHS", "text/html", "general"); 4 richTextBox2.Text = result;
点运行,在richTextBox1中输入要翻译的英文,点按扭,翻译成功。
SOAP貌似无1000字节翻译长度限制,HTTP和AJAX方式是有长度限制的。
对于翻译的准确率,我觉得微软的翻译接口还是相当给力的,尤其是技术方面的翻译,相当给力,速度也很快,推荐大家使用。