def test_stores_details_in_threadlocals(self): """mark_translation stores translation details in threadlocals""" initialize() mark_translation("singular", "plural", "msgstr") self.assertEqual( get_stored_translations(), {"0": {"msgstr": "msgstr", "plural": "plural", "singular": "singular"}} )
def test_ungettext_lazy_plural(self): """ungettext_lazy marks the translation with intermediate markup""" initialize() result = ungettext_lazy('msgstr', 'msgstr_plural', 2) self.assertEqual( result, u'[livetranslation-id 0/]')
def process_request(self, request): initialize(self.is_turned_on(request)) if is_enabled(): active_language = get_language() trans_real._active.clear() trans_real._translations.clear() gettext._translations.clear() activate(active_language)
def test_ugettext(self): """ugettext marks the translation with intermediate markup""" initialize() result = ugettext('msgstr') self.assertEqual(result, u'[livetranslation-id 0/]')