方法'TranslateAsync'没有重载需要Bing Transaltor的4个参数

致力于Windows Phone 7的旧翻译示例代码。 最近,我从这里下载了LanguageServiceClient或翻译器Api http://api.microsofttranslator.com/V2/Soap.svc在我的项目中。 我注意到TranslateAsync的方法有变化 使用这个旧方法在我的页面中调用此方法
_proxy.TranslateAsync(APP_ID, txtInput.Text, from.Code, to.Code);
这个抛出错误信息:   方法'TranslateAsync'没有重载需要4个参数 我在旧的示例代码中发现,它具有: 旧示例代码中存在旧签名:
public void TranslateAsync(string appId, string text, string from, string to) {
    this.TranslateAsync(appId, text, from, to, null);
但是这个RECENT Translator api中的新签名是这样的:
 public void TranslateAsync(string appId, string text, string from, string to, string contentType, string category) {
     this.TranslateAsync(appId, text, from, to, contentType, category, null);
 }
我如何使用这个新签名?什么是contentTye,类别?我在哪里可以获得这些信息或使用这些信息的示例代码? 请帮忙。谢谢     
已邀请:
Microsoft Translator服务的开发人员中心位于:http://www.microsofttranslator.com/dev/,该文档位于此处:http://msdn.microsoft.com/en-us/library/ff512423.aspx 。
Translate
方法的文档指示contentType参数用于指定所提供内容的格式,并接受值“text / plain”或“text / html”。如果指定HTML,则HTML必须格式正确。 category参数支持单个值:general。     
不是您的问题的直接答案,但您可能会发现使用REST API来转换服务而不是SOAP服务更容易 - 使用直接HTTPWebRequest或使用像Hammock这样的REST客户端库来调用此API非常容易。 我在这个ruby脚本http://script.iron7.com/#/Script/Detail?scriptId=46ea32cd1aa4436fa7089d70722f7de8&userLowerCaseName=stuart中使用了这个API(并再次在应用程序http://www.wp7comp.com/translate中使用) -a-公牛得到-多语种,得到牛/) 我发现针对原始HTTP REST而不是针对生成的SOAP进行编码更容易 - 例如翻译是:
http://api.microsofttranslator.com/V2/Http.svc/Translate?appId=YOUR_KEY&from=from+lang&to=to+lang&text=what+you+want+to+translate
    

要回复问题请先登录注册