简体   繁体   English

在C#winform中使用Google Translator在Winform中翻译一些字符串

[英]Translate some string using google translator in winform in C# winform

I want to translate a string in my winform application. 我想在我的winform应用程序中翻译一个字符串。 i want to translate this from google translator.So my way is to use the scraping html methode using "HtmlAgilityPack". 我想从谷歌翻译器翻译此。所以我的方法是使用“ HtmlAgilityPack”使用抓取html方法。 Using the HTMLAgilityPack i want to show the translated string into a label in my winform.I googled but i failed to do that.How can i do that??? 我想使用HTMLAgilityPack在winform中将转换后的字符串显示到标签中。我用google搜索了但没有成功,该怎么办? N:B:i dont want to use google tranlator api instead of this I trid like this : N:B:我不想使用google tranlator api而不是我这样做:

using HtmlAgilityPack; 
........
var webGet = new HtmlWeb();
var document = webGet.Load(
"http://translate.google.com/#en/bn/this%20is%20my%20string");
 var node = document.DocumentNode.SelectNodes(
"//span[@class='short_text' and @id='result_box']");
 if (node != null)
    {
  foreach (var xx in node)
   {
    x = xx.InnerText;
    MessageBox.Show(x);
   }
   }

查看有关如何使用Google API进行翻译的代码段

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM