本文介绍了如何将html页面从英语翻译成阿拉伯语c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

有没有办法将Html页面从语言转换为另一个用户C#



i已经使用

  public   string  TranslateData( string 资源)
{
// string fromCulture = from .Name;
// string toCulture = to.Name;
// string translationMode = string.Concat(fromCulture,_,toCulture);

string url = String .Format( http://babelfish.yahoo.com/translate_txt?lp= {0}& tt = urltext& intl = 1& doit = done& urltext = { 1} en_ar,HttpUtility.UrlEncode(resource));
WebClient webClient = new WebClient();
webClient.Encoding = System.Text.Encoding.Default;
string page = webClient.DownloadString(url);

int start = page.IndexOf( < div style = \padding:0.6em; \>)+ < div style = \padding:0.6em; \> .Length;
int finish = page.IndexOf( < / div>,开始);
string retVal = page.Substring(start,finish - start);
return retVal;

}





和结果是

附加信息:远程服务器返回错误:(414)Request-URI太大。

其中资源是Html内容页面



谢谢

解决方案

Dear All,
Is There Any Way To Translate Html Page from Language to another User C#

i have Used

public string TranslateData(string resource)
{
  //  string fromCulture = from.Name;
  //  string toCulture = to.Name;
  //  string translationMode = string.Concat(fromCulture, "_", toCulture);

    string url = String.Format("http://babelfish.yahoo.com/translate_txt?lp={0}&tt=urltext&intl=1&doit=done&urltext={1}", "en_ar", HttpUtility.UrlEncode(resource));
    WebClient webClient = new WebClient();
    webClient.Encoding = System.Text.Encoding.Default;
    string page = webClient.DownloadString(url);

    int start = page.IndexOf("<div style=\"padding:0.6em;\">") + "<div style=\"padding:0.6em;\">".Length;
    int finish = page.IndexOf("</div>", start);
    string retVal = page.Substring(start, finish - start);
    return retVal;

}



and the result Was
Additional information: The remote server returned an error: (414) Request-URI Too Large.
where resource is The Html Content Page

Thanks

解决方案


这篇关于如何将html页面从英语翻译成阿拉伯语c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 05:43