Switch from optparse to argparse wherever possible

This PR switches to argparse where possible (outside of optrecurse for now).

It also gets rid of translate/tools/detectencoding - old, unmaintained, unused.