title: Why this google translate code isnt working?
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  using System.Net;
  using System.Text.RegularExpressions;
  
  namespace WindowsFormsApplication1
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
              TranslateText("hi", "German");
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
  
          }
  
  
           public static string TranslateText(string input, string languagePair)
          {
              return TranslateText(input, languagePair, System.Text.Encoding.UTF7);
          }
  
          /// &lt;summary&gt;
          /// Translate Text using Google Translate
          /// &lt;/summary&gt;
          /// &lt;param name="input"&gt;The string you want translated&lt;/param&gt;
          /// &lt;param name="languagePair"&gt;2 letter Language Pair, delimited by "|". 
          /// e.g. "en|da" language pair means to translate from English to Danish&lt;/param&gt;
          /// &lt;param name="encoding"&gt;The encoding.&lt;/param&gt;
          /// &lt;returns&gt;Translated to String&lt;/returns&gt;
          public static string TranslateText(string input, string languagePair, Encoding encoding)
          {
              string url = String.Format("http://www.google.com/translate_t?hl=en&amp;ie=UTF8&amp;text={0}&amp;langpair={1}", input, languagePair);
  
              string result = String.Empty;
  
              using (WebClient webClient = new WebClient())
              {
                  webClient.Encoding = encoding;
                  result = webClient.DownloadString(url);
              }
  
              Match m = Regex.Match(result, "(?&lt;=&lt;div id=result_box dir=\"ltr\"&gt;)(.*?)(?=&lt;/div&gt;)");
  
              if (m.Success)
                  result = m.Value;
              MessageBox.Show(result);
  
              return result;
          }
  
      }
  }
  </code></pre>
  
  <p>I added in the constructor the line: </p>
  
  <pre><code>TranslateText("hi", "German");
  </code></pre>
  
  <p>And in the bottom i added:</p>
  
  <pre><code>MessageBox.Show(result);
  </code></pre>
  
  <p>I wanted for the test to translate the word "hi" to German
  But the result im getting and in the messagebox is a very long text wich is containing all the google website.</p>
  
  <p>I tried to go manualy to the web site in the string url address and its working im getting to the google translate website.</p>
  
  <p>I dont understand why it dosent work.
  I want later to put instead "hi" some text from a text file.</p>
  
  <p>I tried ot use breakpoint and found that this part the Success is all the time return false dont know why: </p>
  
  <pre><code>if (m.Success)
      result = m.Value;
  </code></pre>