Improve code for translation module

Trying again. Not sure why these tests don't run for me locally, but apparently they pass on Travis.

This doesn't change how the translation module works. It merely changes the logic around constructing the URL to make it a bit easier to follow, and avoids using a variable named `input` (because that is a builtin function for Python).