Javascript: How to auto translate a website?


<!DOCTYPE html>
<html lang="en-US">

<h1> auto translate</h1>

<p>Hello everybody!</p>

<p>Translate this page:</p>

<div id="google_translate_element" style=""></div>

<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
  	pageLanguage: 'en',
  }, 'google_translate_element');
  	var select = document.querySelector('');
  	select.value    = "fr"; 
  	select.dispatchEvent(new Event('change'));

<script type="text/javascript" src="//"></script>

<p>You can translate the content of this page by selecting a language in the select box.</p>


Online Demo:

How to auto translate a website

You can hide zone select language:

<div id="google_translate_element" style="display:none;"></div>

or you can hide toolbar:


Online demo:

Recent search terms:

  • auto translate website javascript
  • google auto translate html code
  • javascript auto translate page with google auto-translate
  • translate website automatically javascript
  • translate website javascript
  • website translate html javascript

Leave a Reply