Example #1
0
 def test_context(self):
     _ = i18n.Translator(translator=mockTranslator)
     ctx = context.WebContext()
     cfg = i18n.I18NConfig(domain='thud')
     ctx.remember(cfg)
     s = _('foo')
     r = flat.ten.flatten(s, ctx)
     self.assertEquals(r, "MOCK(domain='thud')[foo]")
Example #2
0
 def test_classInit_beats_context(self):
     _ = i18n.Translator(translator=mockTranslator, domain='baz')
     ctx = context.WebContext()
     cfg = i18n.I18NConfig(domain='not-used')
     ctx.remember(cfg)
     s = _('foo')
     r = flat.ten.flatten(s, None)
     self.assertEqual(r, "MOCK(domain='baz')[foo]")
Example #3
0
 def test_remember(self):
     ctx = context.WebContext()
     cfg = i18n.I18NConfig(domain='foo')
     ctx.remember(cfg)