title: Translate an array of strings using Microsoft Translator in c#
body: <p>i'm working on a c# app that translates xml files , i parsed the xml file, extracted the strings to translate and stored them in a string array now i'm trying to send this string array through http to translate it using this :</p>
  
  <pre><code>/*string[] translateArraySourceTexts = GetStringArray("./Traduction/xml.xml");*/
  
         public static string[] GetStringArray(string file)
      {
          XDocument doc = XDocument.Load(file);
  
          var sentences = from l in doc.Descendants("sentence") select (string)l.FirstNode.ToString();
  
          return sentences.ToArray();
      }
  
  { string[] strarr = GetStringArray("./Traduction/xml.xml");
  </code></pre>
  
  <p>/*loop to store strarr strings in translateArraySourceTexts */</p>
  
  <pre><code>        for (int i = 0; i &lt; strarr.Count(); i++)
          {
           string[] translateArraySourceTexts = { strarr[i] };
  
  
  string uri = "http://api.microsofttranslator.com/v2/Http.svc/TranslateArray";
                          string body = "&lt;TranslateArrayRequest&gt;" +
                                           "&lt;AppId /&gt;" +
                                           "&lt;From&gt;{0}&lt;/From&gt;" +
                                           "&lt;Options&gt;" +
                                              " &lt;Category xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" /&gt;" +
                                               "&lt;ContentType xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\"&gt;{1}&lt;/ContentType&gt;" +
                                               "&lt;ReservedFlags xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" /&gt;" +
                                               "&lt;State xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" /&gt;" +
                                               "&lt;Uri xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" /&gt;" +
                                               "&lt;User xmlns=\"http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2\" /&gt;" +
                                           "&lt;/Options&gt;" +
                                           "&lt;Texts&gt;" +
                                           "&lt;string xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"&gt;{strarr[i]}&lt;/string&gt;" +
                                           "&lt;To&gt;{5}&lt;/To&gt;" +
                                        "&lt;/TranslateArrayRequest&gt;";
                          string reqBody = string.Format(body, from, "text/plain", translateArraySourceTexts[i], to);}
  </code></pre>
  
  <p>//This is the xml file i'm using :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;document source="user"&gt;
      &lt;sentences&gt;
          &lt;sentence lang="fr" id="123"&gt;
              salut tout le monde !
          &lt;/sentence&gt;
          &lt;sentence lang="fr" id="123"&gt;
              salut tout le monde !
          &lt;/sentence&gt;
          &lt;sentence lang="fr" id="123"&gt;
              salut tout le monde !
          &lt;/sentence&gt;
          &lt;sentence lang="fr" id="123"&gt;
              salut tout le monde !
          &lt;/sentence&gt;
          &lt;sentence lang="fr" id="123"&gt;
              salut tout le monde !
          &lt;/sentence&gt;
      &lt;/sentences&gt;
  &lt;/document&gt;
  </code></pre>
  
  <p>so i guess my array have to contain the sentence " salut tout le monde !" 5 times
  but i dont get the full strings in response only 4, while my array contains 5</p>