You can translate the content of your website into several languages using the free Google Translate service. It supports 100+ languages.

Let’s see how to include google Translate on your website, by adding a few lines of javascript code.

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

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

<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Here is the sample HTML &  video demo

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

<h1>Translate your web page content</h1>

<p>This is a paragraph</p>

<p>Choose your language to translate</p>

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

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

<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

</body>
</html>

Demo

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *