user280255
user280255

Reputation: 31

how we can i use google translator api in my website

Well I want to use Google api translator in my website and when I am putting this api code in my html page it's working fine.

----------------------------------google translator code :-----------------------------

<div id="google_translate_element" ></div>
<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en'
  }, 'google_translate_element');
}

</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

I want to put the code in when I am putting this code in iframe then it shows everything.

But while changing the language it changes the language of elements in the iframe it doesn't affect outside the iframe.

Upvotes: 3

Views: 13213

Answers (1)

Roberto Aloi
Roberto Aloi

Reputation: 31015

I guess this is why the iframe tag is used to include an external document into an existing one.

Google Translator will translate the content of the iframe only, since it has no clue about the container document.

Please see also:

http://forums.macrumors.com/showthread.php?t=467248

Upvotes: 2

Related Questions