I am afraid there is no simply way, as said best would be not to add custom code inside page builders, that is not recommended way in General.
You should add it via some other method, like inside your child theme, code plugin, custom code function / shortcode and etc. Otherwise it is difficult to maintain such code, as often is forget and can break your page layout, even without WPML plugin.
I understand, lets try to reproduce the issue on next test site and then I will further check with our ATE team why this breaks and if we might have a bug from our side, and if not we can try to provide a workaround for you.
I created a minimal installation of WordPress, WPML, and all necessary WPML add-ons, and themes.
You can access the WordPress dashboard using the link below:
- hidden link
Create new page with HTML widget and add your script, translate and same issue should happen.
We did some testing and isolated the problem, it does look like the recent ATE fixes, well, didn't fix all cases, and somewhat surprisingly this happens because of ATE breaking the trans-unit source rather than the target.
Our ATE team is checking, and we will try to provide the fix as soon as possible, but note it may take few days.
My apology for such delay in fixing this issue, and me possible taking few days since following wrong lead.