Add google translate button to your site

Saw the translate button for the first time in this site -

Thought it is super cool. Wanted to add it to my site as well.

Google translate will only keep improving, to be able to have my site in any language the reader wants - is also invaluable.

Asked the author of the site how he did it, he referred me here -

And this is my implementation google-translate.js:

function googleTranslateElementInit() {
    new google.translate.TranslateElement(
        { pageLanguage: 'en' },

const script = document.createElement('script');
script.type = 'text/javascript';
script.src = '';

Added a piece in html:

<div id="google_translate_element" style="float:right;"></div>"

And it works! Cool!