Learn how to add a Google Translate button on your web page!

  • By reza rastegar
  • Last update: Jul 19, 2022
  • Comments: 0

Learn how to add a Google Translate button on your web page!

By adding these codes to the website, you can translate your website into other languages

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

    <script type="text/javascript"
        src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <script type="text/javascript">
        function googleTranslateElementInit() {
            new google.translate.TranslateElement({ pageLanguage: 'en' }, 'google_translate_element');
        }
    </script>

google-translate-1

google-translate-2

google-translate-3

google-translate-4

Github

https://github.com/rezarastegar2003/google-translate-button