google API translate, only a div into page

I have an html page, and I would use Google Translate for translate only a div into my page.

<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'it'}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

With this code, google translate everything in the page. But if I wanna translate only a piece. How I can do it?

  • Access Denied Error when using gapi.auth.authorize
  • Google drive picker error
  • Google calendar API update “Missing end time”
  • Google javascript sign-in api: no offline access
  • custom infowindow box with google maps api v3?
  • How to use Google Drive API to download files with Javascript
  • Thanks!

  • Google API V3: Problem with polygon mouseover events if groundOverlay is also defined
  • Execute a forEach like a waterfall in async
  • Google Contacts API with Google JavaScript Client Lib
  • Google Visualization Issue with Small Values in Pie Chart
  • How to dynamically add rows/columns to a Google Column Chart
  • How to increase annotation font size and bold the annotation value in line chart of google api chart?
  • 2 Solutions collect form web for “google API translate, only a div into page”

    Check the examples at Google AJAX Language API.

    google.language.translate("Hello world", "en", "es", function(result) {
      if (!result.error) {
        var container = document.getElementById("translation");
        container.innerHTML = result.translation;
      }
    });
    

    use innerHTML to get hold of the contents of your DIV. You may have to strip out formatting first, though.

    ok, but how to open any named <div> of a internet web page in my page with <iframe> tag? Is it possible in general, not to display (in iframe) the whole page, but only the part of it (without balast arround)?

    I know e.g. this for whole pages :

    <div>
      <iframe src ="http://www.colosseum.cz/vzdelavani-a-informace/zpravy" width="98%" height="600" style="border: 3px;">
        <p>unsupported</p>
      </iframe> 
    </div>