def test_load_translation_with_accept_language_unknown(self): # Mock a header cherrypy.request.headers["Accept-Language"] = "br_CA" # Load default translation t = i18n.get_translation() self.assertTrue(isinstance(t, gettext.GNUTranslations)) self.assertEqual("en", t._lang)
def _get_translation(domain): """ Used in templates to load a different translation domain. """ t = i18n.get_translation(domain) t.ugettext = _make_new_gettext(t.ugettext) t.ungettext = _make_new_ngettext(t.ungettext) return t
def test_load_translation(self): # Load default translation t = i18n.get_translation() self.assertTrue(isinstance(t, gettext.GNUTranslations)) self.assertEqual("en", t._lang)