You are aware that this functionality already exists? It is called import messages from translation server and is situated in 5.1 branch
If you port it over the 5.2 the translation server is already prepared to deal with it.
files definitely needed:
download-messages (this is installed on the server)
import-messages-from-ts
Furtermore the parameter to define if your server acts as a translation server or not.
Sorry that I cant do it on my own.