Improve support for the user's language preferences.
Fix ValueError: too many values to unpack.
Fix NameError: global name 'ranked' is not defined.
Merge pull request #930 from GPHemsley/languages

Improve support for the user's language preferences.