Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
 def test_load_translation(self):
     # Load default translation
     t = i18n.get_translation()
     self.assertTrue(isinstance(t, gettext.GNUTranslations))
     self.assertEqual("en", t._lang)
Ejemplo n.º 6
0
 def test_load_translation(self):
     # Load default translation
     t = i18n.get_translation()
     self.assertTrue(isinstance(t, gettext.GNUTranslations))
     self.assertEqual("en", t._lang)