microsoft provides API service for the language converter. using this you can convert one language to other languae. Here I am putting the code for converting the English words to chinese words. If you want to convert any other language to any other languae you can also achive this. Because microsoft bing translator provides a lot of languges support and enhanceing the translating power day by day.
References :- http://www.microsoft.com/web/post/using-the-free-bing-translation-apis
To get your Bing App ID, visit http://www.bing.com/developers/appids.aspx, and sign in with your Windows Live ID
Before using the above code include the following name spaces:
using System.Net;
public string micorsoftApi(string wordToBeTranslate)
{
//Creating the object of proxy
WebProxy p = new WebProxy();
//crating nexwork crediential
NetworkCredential nc = new NetworkCredential("NetworkOrSystemUserId", "NetWorkOrSystemPassword", "YourNetWorkDomainName");
string proxyURL=”put the URL of your Network proxy”
p = new WebProxy(proxyURL, true, null, nc);
//setting applicaiton Id Bing translator appId change the application //id according to applicaiton you get the the application id for the //perticuler URL after registed that site on Bing BD
string appId = "xyz";//Get API ID by registed on bing and put here
string tobetranslated = wordToBeTranslate.Trim();
//setting from language parameter en for english
string fromLang =”en”;
//settting to language parameter zh-CHT for chainis traditional and //zh-CHS for chinise simplified
string toLang =”zh-CHS”;
string translatedText = string.Empty;
string uri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?appId="+ appId + "&text=" + tobetranslated + "&from=" + fromLang + "&to=" + toLang;
//creating object and of webrequest
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
//setting proxy and network credentials to web request
request.Proxy = p;
request.Credentials = nc;
//geting the response from bing appi
WebResponse response = request.GetResponse();
//reading the the data form response as stream
Stream strm = response.GetResponseStream();
StreamReader reader = new System.IO.StreamReader(strm);
translatedText = reader.ReadToEnd();
//wriint the converted text into chinise
Response.Write("The translated text is: '" + translatedText + "'.");
// lbl.Text = "The translated text is: '" + translatedText + "'.";
response.Close();
return translatedText;
}
Other Refrences:-
http://sdk.microsofttranslator.com/
http://www.microsofttranslator.com/mix2010/
http://www.microsofttranslator.com/
http://www.microsofttranslator.com/dev/
Hope this code will help all of you.
Jai Durga Ji Ki
Praveen Kumar Singh Bisen
References :- http://www.microsoft.com/web/post/using-the-free-bing-translation-apis
To get your Bing App ID, visit http://www.bing.com/developers/appids.aspx, and sign in with your Windows Live ID
Before using the above code include the following name spaces:
using System.Net;
public string micorsoftApi(string wordToBeTranslate)
{
//Creating the object of proxy
WebProxy p = new WebProxy();
//crating nexwork crediential
NetworkCredential nc = new NetworkCredential("NetworkOrSystemUserId", "NetWorkOrSystemPassword", "YourNetWorkDomainName");
string proxyURL=”put the URL of your Network proxy”
p = new WebProxy(proxyURL, true, null, nc);
//setting applicaiton Id Bing translator appId change the application //id according to applicaiton you get the the application id for the //perticuler URL after registed that site on Bing BD
string appId = "xyz";//Get API ID by registed on bing and put here
string tobetranslated = wordToBeTranslate.Trim();
//setting from language parameter en for english
string fromLang =”en”;
//settting to language parameter zh-CHT for chainis traditional and //zh-CHS for chinise simplified
string toLang =”zh-CHS”;
string translatedText = string.Empty;
string uri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?appId="+ appId + "&text=" + tobetranslated + "&from=" + fromLang + "&to=" + toLang;
//creating object and of webrequest
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
//setting proxy and network credentials to web request
request.Proxy = p;
request.Credentials = nc;
//geting the response from bing appi
WebResponse response = request.GetResponse();
//reading the the data form response as stream
Stream strm = response.GetResponseStream();
StreamReader reader = new System.IO.StreamReader(strm);
translatedText = reader.ReadToEnd();
//wriint the converted text into chinise
Response.Write("The translated text is: '" + translatedText + "'.");
// lbl.Text = "The translated text is: '" + translatedText + "'.";
response.Close();
return translatedText;
}
Other Refrences:-
http://sdk.microsofttranslator.com/
http://www.microsofttranslator.com/mix2010/
http://www.microsofttranslator.com/
http://www.microsofttranslator.com/dev/
Hope this code will help all of you.
Jai Durga Ji Ki
Praveen Kumar Singh Bisen