invitation india
UnexpectedWeb
Connect

Popular Technology Blog where you'll find some interesting things around the web, that you never knew existed.

link Link copied

how to add google translate plugin to any website

Share on: link Link copied
Learn how to convert your website/blog into a multi language website. You can add Google website translation option to your website by copy pasting few lines of code. A multilingual website helps to improve user experience and engagement. let's implement it.

Demo:

1. Add this html code where you want to see google page translation option.
<div id="g_translate_option"></div> 

2. Change your page default language in bellow JavaScript function pageLanguage: 'en' 

<div id="g_translate_option"></div>

<script>

  function googleTranslateInit() {

      new google.translate.TranslateElement({pageLanguage: 'en'}, 'g_translate_option');

  }

</script>

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

Source: w3schools 

No comments:

Powered by Blogger.