Google Translate. Uncaught TypeError: reduce of empty array with no initial value

201 views Asked by At

There is an error in Google Translate when I delete pageLanguage from configuration, trying to add Google translate to my website. And I know how to reproduce it, I tested in different environments.

The normal adding is:

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

<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

So I was testing things and I quit pageLanguage parameter, letting this as:

new google.translate.TranslateElement({}, 'google_translate_element');

Then an error ocurred, but it's a persistant error even if I add pageLanguage again. This is the error:

Uncaught TypeError: reduce of empty array with no initial value
    Kx https://translate.googleapis.com/_/translate_http/_/js/k=translate_http.tr.es.q7BCs08VHLM.O/d=1/exm=el_conf/ed=1/rs=AN8SPfqUgoHY5OzWyKKWO8GAPGWgGYiyAw/m=el_main:412
    done https://translate.googleapis.com/_/translate_http/_/js/k=translate_http.tr.es.q7BCs08VHLM.O/d=1/exm=el_conf/ed=1/rs=AN8SPfqUgoHY5OzWyKKWO8GAPGWgGYiyAw/m=el_main:410

I want to put Google Translate to work again.

0

There are 0 answers