protected void Button1_Click(object
sender, EventArgs e)
{
// using Google
Translate
string
Fromlang = "en";
string Tolang = "gu";
string url = @"http://translate.google.com/translate_a/t?client=t&text="
+ txtFrom.Text +
"&hl=en&sl="+Fromlang+"&tl="+Tolang+"&ie=UTF-8&oe=UTF-
8&multires=1&otf=1&ssel=3&tsel=3&sc=1";
"&hl=en&sl="+Fromlang+"&tl="+Tolang+"&ie=UTF-8&oe=UTF-
8&multires=1&otf=1&ssel=3&tsel=3&sc=1";
WebRequest client = WebRequest.Create(url);
WebResponse resp = client.GetResponse();
Stream strm = resp.GetResponseStream();
StreamReader sr = new
StreamReader(strm);
string strResp = sr.ReadToEnd();
dvTo.InnerHtml
= strResp.Split(']')[0].Split(',')[0].Replace('[',
' ').Replace('"',' ');
}
<div>
<asp:TextBox ID="txtFrom"
runat="server"
TextMode="MultiLine"
Height="88px"
Width="235px"></asp:TextBox>
<br />
<asp:Button ID="Button1"
runat="server"
Text="Button"
OnClick="Button1_Click"
/>
<div id="dvTo" runat="server"
> </div>
</div>
No comments:
Post a Comment