question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lottie causing problems with Google Translate

See original GitHub issue

Tell us about your environment Mac 2015 Retina Display

Browser and Browser Version: Chrome v.67

Problem My animations were working great on the website! I decided to add Google Translate and ended up getting hundreds of errors every second. I discovered by deduction that this was because of my Lottie animations. My HTML looks like this for the animation:

<div id="choosing" class="cardAnim"></div>

and the js :

var animation2 = bodymovin.loadAnimation({ container: document.getElementById('choosing'), renderer: 'svg', loop: true, autoplay: true, path: '/img/choosing/data.json', assetsPath: '' }) .

Anyways, the error Google translate is giving me from Lottie is :

element_main.js:405 Uncaught TypeError: a[b].target.className.indexOf is not a function at au.v.Ai (element_main.js:405)

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15

github_iconTop GitHub Comments

6reactions
zayckercommented, Dec 15, 2019

The issue continues to live. It is almost 2020 😃 The cause is the “Google Website Translator” embedded into Chrome now (not as an extension as it was earlier). When you try to open any non-native language page in Chrome it’s “Translator” starts to parse nodes on the page and checks it’s className in a straight way:

if (a[b].target && a[b].target.className && (0 <= a[b].target.className.indexOf(bc) ...

it checks only the existence of className and executes indexOf right after it. But for SVGElement the className is an instance of SVGAnimatedString which doesn’t have #indexOf().

I tried meta[name="google"][content="notranlate"], I tried class="notranslate". Often it doesn’t help. Especially with lazy-loaded SVGs (we have react + lottie + lazy loaded svg-jsons).

I tried to declare SVGAnimatedString.prototype.indexOf at the top of the page. But seems like Translator works in its own sandbox or not sure, didn’t investigate.

We were forced to switch off Sentry error tracker cause of the frequency of this error and exceeding our budget without profit. Especially when there is animation and exceptions are generated infinitely.

Some of the stackoverflow answers tell “turn off translator inside browser properties”. Aha. Inside the client’s browser. Give me just a sec…

Researching for a solution.

6reactions
mrharelcommented, Jul 18, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

How Tinder Solves Complex Lottie Localizations with Server ...
Using Lottie for these complex animations, introduced the problem of localization if the animation was rendered as a graphic rather than separated text...
Read more >
lottie-animated svg very pixelated/blurry in Safari but not ...
When scaling a svg-animation in Safari (transform: scale(>1)), it will be rendered extremely pixelated/blurred. In Chrome and Firefox it renders ...
Read more >
What's wrong with Google Translate in Italian? - This is Italy
The problem is that you can't check if it's right. Only a translator can do that. And he will tell you that when...
Read more >
After Effects to Code: Lottie from Airbnb - School of Motion
I didn't really have too many concerns about it. Joey Korenman: Cool. Cool. Yeah. I've talked to other people who have worked for...
Read more >
Adobe XD v.45 : Lottie animation not showing on sharing link
Hello everyone, I have a problem with lottie animation, it does not play or show when I create a test link, but everything...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found