Most of the code for translations