I have written translators and they are really hard. I think training on code bases is the way to go but I am skeptical overall that it is even worth the effort. The problem is that the translation doesn't get you all the way there. The code produced is buggy and wrong in most cases. You probably get a better result from re-designing and re-implementing.
I wonder what the data being trained on even is. It has to include successful translations, right? There are not many of those. Not enough for a good result.