+ 4

Why is this code using the Google Translator not working?

Can anyone please point out the error? https://code.sololearn.com/WK7Msok3x21l/?ref=app

11th Aug 2018, 9:20 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
4 Respostas
+ 5
Yep, Calvin. It seems that only works on PC, I just tried it from my phone and I get an error because it can not use cookies correctly.
11th Aug 2018, 10:27 AM
Mickel
Mickel - avatar
+ 4
The code is working correctly for me. Although I would order the scripts in a different way: <script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> <script> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element'); } </script>
11th Aug 2018, 9:54 AM
Mickel
Mickel - avatar
+ 2
You need to add <div id="google_translate_element"></div> for google translate to form the translated page. And I think this only works on PC, not on phone webview.
11th Aug 2018, 10:22 AM
Calviղ
Calviղ - avatar
+ 1
Mickel does this one too work for you. I only see the text with no optn. to translate it. https://code.sololearn.com/WkmaW6sykBAR/?ref=app
11th Aug 2018, 10:08 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar