Uncaught TypeError with Google Translator

Discussion of non-phpBB related topics with other phpBB.com users.
Forum rules
General Discussion is a bonus forum for discussion of non-phpBB related topics with other phpBB.com users. All site rules apply.
Post Reply
User avatar
Neverlands
Registered User
Posts: 117
Joined: Thu Sep 05, 2002 12:06 am
Location: Vienna / Austria
Contact:

Uncaught TypeError with Google Translator

Post by Neverlands »

Hello,
I hope I am posting in the right forum.
Until a few days ago I was able to translate individual posts following these instructions: Translate post
Since a few days I get this error: Uncaught TypeError: google.translate.SectionalElement is not a constructor

Does anyone have an idea how to solve this problem?

This is my script in the overall_header.html

Code: Select all

<script>
function googleSectionalElementInit() {
  new google.translate.SectionalElement({
    sectionalNodeClassName: 'goog-trans-section',
    controlNodeClassName: 'goog-trans-control',
    background: '#f4fa58'
  }, 'google_sectional_element');
}
</script>
<script type="text/javascript" data-name="googletranslate" data-src="//translate.google.com/translate_a/element.js?cb=googleSectionalElementInit&ug=section&hl=en"></script> 
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26546
Joined: Fri Aug 29, 2008 9:49 am

Re: Uncaught TypeError with Google Translator

Post by Mick »

Did you Google the error? I see a few similar issues using that same piece of code.
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
User avatar
Neverlands
Registered User
Posts: 117
Joined: Thu Sep 05, 2002 12:06 am
Location: Vienna / Austria
Contact:

Re: Uncaught TypeError with Google Translator

Post by Neverlands »

Yes, I did.
I only found one with the exact same error and there's no solution yet: https://stackoverflow.com/questions/75301672/google-translate-sectionalelement-is-not-a-constructor

The others relate to google.translate.TranslateElement not to google.translate.SectionalElement.
User avatar
Miri4ever
Registered User
Posts: 608
Joined: Sat Mar 07, 2015 11:18 am
Contact:

Re: Uncaught TypeError with Google Translator

Post by Miri4ever »

I got some console errors before, but there the translator was working. Since the translation button disappear, there is no more error display at all. It does not show anything. If I try to open this translation link: //translate.google.com/translate_a/element.js I just will see a text file the JavaScript. It seems the JavaScript is not working properly when it displays just the code. The //translate.google.com will still work, but it opens a text translation window instead of translate the text.

So, I am uncertain if the Google link has change or as there is something wrong with the JS Code. I tried to copy this code directly to my page, but also no success in making it work. I just read a few pages, and a JS should never display as plain text if try to open with a browser. And as the file not loaded any more error message inside the console to see.
User avatar
Anișor
Translator
Posts: 273
Joined: Tue Jan 08, 2013 9:36 pm
Location: Arbroath, Angus, Scotland
Contact:

Re: Uncaught TypeError with Google Translator

Post by Anișor »

I think Google discontinued this widget.
Formerly known as Neculai Anisor
Discord: Criminus#1996
Post Reply

Return to “General Discussion”