So I have been using the Google Translate widget on my website to have a language switcher that could easily translate whole webpages into different languages. This is how I embedded it on my website:
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
includedLanguages: 'af,sq,ar,be,bg,ca,zh-CN,zh-TW,hr,cs,da,nl,en,et,tl,fi,fr,gl,de,el,ht,iw,hi,hu,is,id,ga,it,ja,ko,lv,lt,mk,ms,mt,no,fa,pl,pt,ro,ru,sr,sk,sl,es,sw,sv,th,tr,uk,vi,cy,yi'
}, 'google_translate_element');
}
</script>
<script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</div>
I was informed by Google Support that this widget is no longer supported by Google and that I might face code/compatibility issues. They have suggested for me to use Google Cloud Translate (a paid service).
I have checked the translate API and it seems that I need to pass all the texts of my webpages to the translate API just to come up with the translations.
Is there a way where I can use Google Cloud Translate just like how their previous translator widget works, where a language switcher is already provided and translations are on-the-fly with no strings passed? Thank you!