A community contributor found a bug in translate-html where the Beautiful Soup API was being called incorrectly potentially leading to undefined behavior.
This fixes translation with beautifulsoup4>=4.12.1
Modifying contents list directly is not supported by BeautifulSoup:
If you want to modify a tag’s children, use the methods described in Modifying the tree. Don’t modify the the .contents list directly: that can lead to problems that are subtle and difficult to spot.
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#contents-and-children