Update mergelocales to the standards of Python

This is a try to update the mergelocales.py script
However, it is easy to break something in the process (dynamic typing).
Could someone (@albre, maybe?) tell me if it still works as expected?