def test_gettext_lazy(self): text = LazyT('McAvoy or Stewart? These timelines are confusing.') self.assertEqual(unicode(text), u'McAvoy or Stewart? These timelines are confusing.') change_language('de') self.assertEqual(unicode(text), u'McAvoy oder Stewart? Diese Zeitlinien sind verwirrend.')
def test_gettext_lazy(self): text = LazyT('McAvoy or Stewart? These timelines are confusing.') self.assertEqual(str(text), 'McAvoy or Stewart? These timelines are confusing.') change_language('de') self.assertEqual(str(text), 'McAvoy oder Stewart? Diese Zeitlinien sind verwirrend.')
def test_gettext_lazy(): text = LazyT('McAvoy or Stewart? These timelines are confusing.') assert str(text) == 'McAvoy or Stewart? These timelines are confusing.' change_language('de') assert str(text) == 'McAvoy oder Stewart? Diese Zeitlinien sind verwirrend.'
def test_active_translation(self): change_language('de') self.assertEqual(T('McAvoy or Stewart? These timelines are confusing.'), 'McAvoy oder Stewart? Diese Zeitlinien sind verwirrend.') change_language('fr') self.assertEqual(T('McAvoy or Stewart? These timelines are confusing.'), 'McAvoy ou Stewart? Ces délais sont confus.')
def test_active_translation(self): change_language('de') self.assertEqual(T('McAvoy or Stewart? These timelines are confusing.'), u'McAvoy oder Stewart? Diese Zeitlinien sind verwirrend.') change_language('fr') self.assertEqual(T('McAvoy or Stewart? These timelines are confusing.'), u'McAvoy ou Stewart? Ces délais sont confus.')
def test_disable_translations(): change_language('de') assert T('McAvoy or Stewart? These timelines are confusing.') ==\ 'McAvoy oder Stewart? Diese Zeitlinien sind verwirrend.' with disable_translations(): assert T('McAvoy or Stewart? These timelines are confusing.') ==\ 'McAvoy or Stewart? These timelines are confusing.' assert T('McAvoy or Stewart? These timelines are confusing.') ==\ 'McAvoy oder Stewart? Diese Zeitlinien sind verwirrend.'
def update_languages(self, data=None): if data is None: data = self._setting.get(UH_MODULE, "Language") language = LANGUAGENAMES.get_by_value(data) change_language(language)
def apply(self): data = self.get(SETTINGS.UH_MODULE, "Language") language = LANGUAGENAMES.get_by_value(data) change_language(language)
def _apply_Language(self, old, new): language = LANGUAGENAMES.get_by_value(new) change_language(language)
def _on_Language_changed(self, old, new): language = LANGUAGENAMES.get_by_value(new) change_language(language)