コード例 #1
0
    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_tower_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.
        result = translate(dirty_string, ['does_not_exist'])
        eq_(result, dirty_string)

        result = translate(dirty_string, ['tweaked_message_translation'])
        eq_(result, trans_string)
コード例 #2
0
ファイル: test_dotlang.py プロジェクト: Wolf00Bomber/bedrock
    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, 'test_py_extract.py.txt')) as pyfile:
            vals = extract_tower_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.
        result = translate(dirty_string, ['does_not_exist'])
        eq_(result, dirty_string)

        result = translate(dirty_string, ['tweaked_message_translation'])
        eq_(result, trans_string)
コード例 #3
0
ファイル: test_dotlang.py プロジェクト: rlr/bedrock
    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_tower_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("en-US"):
            result = translate(dirty_string, ["does_not_exist"])
            eq_(result, dirty_string)

            result = translate(dirty_string, ["tweaked_message_translation"])
            eq_(result, trans_string)