i18n and refactoring for PR feedback.

Original PR was merged already but this is in response to comments on https://github.com/dimagi/commcare-hq/pull/320.