Add i18n functions for domain and session checks
Fix mock objects for i18n tests
Improve test coverage for i18n
Apply pep8