Hii, Everyone Today i am going to tell you how to add a Google Translate button on your website.

Step 1:

    Add a <div> element with the id “google_translate_element”: inside  <body> tag

<div id=”google_translate_element”></div>

Step 2:

  Add a Script tag in between <head></head>

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

 

Step 3:

    also add some javascript code in your webpages.

There are 3 types of button available for the Google Translate button.

   A.  Vertically

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

 

php developer in delhi

wordpress designer in delhi

  B. Horizontal

 <script type=”text/javascript”>
                    function googleTranslateElementInit() {
                       new google.translate.TranslateElement({pageLanguage: ‘en’, layout:                              google.translate.TranslateElement.InlineLayout.HORIZONTAL}, ‘google_translate_element’);
               }
            </script>

php developer in gurgaon

website designer in laxmi nagar

 

   C.  Dropdown Menu, with no other text:

                  <script type=”text/javascript”>
                         function googleTranslateElementInit() {
                            new google.translate.TranslateElement({pageLanguage: ‘en’, layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, ‘google_translate_element’);
                                 }
                 </script>

wordpress developer in developer in delhi

website designer in delhi

 

And you are ready to translate the content of your page:

Basant Mallick

Secured By miniOrange