I could see the voice actor learning a sentence or two but on occasion the bit goes on for a couple minutes. I feel like with a cartoon it wouldn’t be that hard to find a stand in who sounds close enough or use whoever does the dubbing for that language.
I don’t remember ever seeing them switch out the voice actors.
They just learn the bits in the other language. It’s not like it has to be good. Most of the time they totally butcher it, but who cares?