Fixing widget translations with the free Polylang plugin

in WordPress
I highly prefer Polylang to WPML for multilingual Wordpress websites. However, while I can use the unlimited lifetime pro WPML plugin, I have no licence for the Polylang Pro - and the annual subscription is too expensive for the non-profit stuff.
The problem with the free Polylang is that you can't set language versions for widgets (apart from the "legacy widgets").
This is how I've managed to solve it, with a minimum amount of custom code that can easily be implemented:
https://io.bikegremlin.com/35014/widget-translation-with-free-polylang/
If anyone has a more elegant solution, I'm eager to hear it and improve this.