locked
Translation is being returned from generic system, not the personal one RRS feed

  • Question

  • Hello.

    I have trained and deployed own DE->EN-GB translation system and i have tested it onlne without any issues, but when i use it in the API and provide the category ID i get the generic translation, not the one from m own system.

    string uri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?text=" + 
                    System.Web.HttpUtility.UrlEncode(textForTranslation) + 
                    "&from=" + sourceLanguage + 
                    "&to=" + targetLanguage + 
                    "&category=" + category;
    
                string authToken = "Bearer" + " " + accessToken;
                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
                httpWebRequest.Headers.Add("Authorization", authToken);
                WebResponse response = null;
                response = httpWebRequest.GetResponse();
    
     response = httpWebRequest.GetResponse();
    
                    using (Stream stream = response.GetResponseStream())
                    {
                        System.Runtime.Serialization.DataContractSerializer dcs = new System.Runtime.Serialization.DataContractSerializer(Type.GetType("System.String"));
                        string translation = (string)dcs.ReadObject(stream);
    
                        return translation;
                    }

    Thanks in advance!

    Wednesday, February 24, 2016 8:20 PM

All replies

  • There is nothing wrong with your code. Should work as is.

    Did you actually build your custom system for "en-gb"? The translate call with a category ID will succeed for any language pair IF there is a deployed system with this category ID, even if it is for a different language. When for a different language, it'll give you the general domain result.

    Thursday, February 25, 2016 2:13 AM