def test_extract_message_tweaks_do_not_break(self): """ Extraction and translation matching should tweak msgids the same. """ clean_string = u'Stuff about many things.' dirty_string = u'Stuff\xa0about\r\nmany\t things.' trans_string = u'This is the translation.' # extraction with open(os.path.join(ROOT, 'extract_me.py')) as pyfile: vals = extract_python(pyfile, ['_'], [], {}).next() eq_(vals[2], clean_string) # translation # path won't exist for en-US as there isn't a dir for that # in locale. with self.activate('fr'): result = translate(dirty_string, ['does_not_exist']) eq_(result, dirty_string) result = translate(dirty_string, ['tweaked_message_translation']) eq_(result, trans_string)
def test_extract_message_tweaks_do_not_break(self): """ Extraction and translation matching should tweak msgids the same. """ clean_string = u'Stuff about many things.' dirty_string = u'Stuff\xa0about\r\nmany\t things.' trans_string = u'This is the translation.' # extraction with open(os.path.join(ROOT, 'extract_me.py')) as pyfile: vals = extract_python(pyfile, ['_'], [], {}).next() eq_(vals[2], clean_string) # translation # path won't exist for en-US as there isn't a dir for that # in locale. with self.activate('fr'): result = translate(dirty_string, ['does_not_exist']) eq_(result, dirty_string) result = translate(dirty_string, ['tweaked_message_translation']) eq_(result, trans_string)
def test_extract_message_tweaks_do_not_break(self): """ Extraction and translation matching should tweak msgids the same. """ clean_string = u'Stuff about many things.' dirty_string = u'Stuff\xa0about\r\nmany\t things.' trans_string = u'This is the translation.' # extraction pypath = ROOT_PATH.joinpath('extract_me.py') with io.open(str(pypath), 'rb') as pyfile: vals = next(extract_python(pyfile, ['_'], [], {})) assert vals[2] == clean_string # translation # path won't exist for en-US as there isn't a dir for that # in locale. with self.activate('fr'): result = translate(dirty_string, ['does_not_exist']) assert result == dirty_string result = translate(dirty_string, ['tweaked_message_translation']) assert result == trans_string
def test_extract_message_tweaks_do_not_break(self): """ Extraction and translation matching should tweak msgids the same. """ clean_string = u'Stuff about many things.' dirty_string = u'Stuff\xa0about\r\nmany\t things.' trans_string = u'This is the translation.' # extraction pypath = ROOT_PATH.joinpath('extract_me.py') with open(str(pypath)) as pyfile: vals = extract_python(pyfile, ['_'], [], {}).next() assert vals[2] == clean_string # translation # path won't exist for en-US as there isn't a dir for that # in locale. with self.activate('fr'): result = translate(dirty_string, ['does_not_exist']) assert result == dirty_string result = translate(dirty_string, ['tweaked_message_translation']) assert result == trans_string