DEV Community

Cover image for How to add Google Translate to your website
Federico Navarrete
Federico Navarrete

Posted on • Updated on • Originally published at

How to add Google Translate to your website

Sometimes you would like to add to your website a quick widget to allow your users to translate into their language. Google has a simple widget that you can add with some lines of code:

    function googleTranslateElementInit() {
        new google.translate.TranslateElement(
            //here you add the supported languages like en, es, zh, nl, de, etc.
            {pageLanguage: 'en'},
<script src=""></script>

<div id="google_translate_element"></div>
Enter fullscreen mode Exit fullscreen mode

And that's all.

Follow me at:

LinkedIn YouTube Instagram Cyber Prophets Sharing Your Stories
LinkedIn YouTube Instagram RedCircle Podcast RedCircle Podcast

sponsor me

Oldest comments (0)