title: Google Translate: Callback when a language is selected
body: <p>I have added the Google Translate plugin to my web page. How can I get a callback to my JavaScript function whenever the user selects a language from the drop down menu that the plugin adds to my web page? The Google Translate API documentation does not seem to have any information on this. I have read through the JavaScript code of the Google Translate plugin and I cannot see anything that is helpful.</p>
  
  <p>It will also be fine if I get a callback to my function just before the translation of my web page begins or just after the translation of my web page ends or just before or after the translation of any specific element in my web page. </p>
  
  <p>Here is the HTML for a simplified version of my web page:</p>
  
  <pre><code>  &lt;html&gt;
      &lt;head&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
  
          &lt;!-- Google Website Translator plugin --&gt;
  
          &lt;div id="google_translate_element"&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;
          function googleTranslateElementInit() {
            new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'es', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
          }
          &lt;/script&gt;
          &lt;script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"&gt;&lt;/script&gt;
  
  
          &lt;div&gt;
              &lt;p&gt;This part can be translated using the Google Translator plugin.&lt;/p&gt;
          &lt;/div&gt;
  
          &lt;script type="text/javascript"&gt;
              function translationCallback() {
                  // This function needs to be called when Google translates this web page.
                  alert("A language was selected from the Google Translator plugin dropdown");
              }
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>