Search code examples
c#windows-phone-7localizationlanguage-translationmicrosoft-translator

No overload for method 'TranslateAsync' takes 4 arguments for Bing Transaltor


working on an old translation sample code for windows phone 7.

Recently, I have downloaded the LanguageServiceClient or translator Api from this http://api.microsofttranslator.com/V2/Soap.svc in my project.

I notice there is a change in the method for TranslateAsync

use this old method calling this method in my page

_proxy.TranslateAsync(APP_ID, txtInput.Text, from.Code, to.Code);

This throw error message:

No overload for method 'TranslateAsync' takes 4 arguments

I discovered in the old sample code, it has:

Old Signature Existed in Old Sample Code:

public void TranslateAsync(string appId, string text, string from, string to) {
    this.TranslateAsync(appId, text, from, to, null);

BUT the new signature in this RECENT Translator api is this :

 public void TranslateAsync(string appId, string text, string from, string to, string contentType, string category) {
     this.TranslateAsync(appId, text, from, to, contentType, category, null);
 }

How Do I use this New Signature? What are contentTye, category ? Where can I get these info or sample code that use these?

Please help. Thanks


Solution

  • The developer center for the Microsoft Translator service is here: http://www.microsofttranslator.com/dev/ which gives the documentation being located here: http://msdn.microsoft.com/en-us/library/ff512423.aspx. The documentation for the Translate method indicates that the contentType parameter is used to specify the format of the supplied content and accepts the values "text/plain" or "text/html". If you specify HTML, then the HTML must be well-formed. The category parameter supports a single value: general.