Exemplo n.º 1
0
    def test_empty_translations(self):
        locale_dir = self.test_dir.joinpath('locale_empty')
        locale_dir.mkdir(parents=True)
        self.assertFalse(os.listdir(locale_dir))

        instance = updater.TranslationsUpdater(locale_dir, self.test_dir.joinpath('source'))
        self.assertFalse(instance.is_translations_generated())
        self.assertFalse(instance.regenerate_all())
        self.assertEqual(Counter(updater.SUPPORTED_LANGUAGES), Counter(os.listdir(locale_dir)))

        shutil.rmtree(locale_dir)
Exemplo n.º 2
0
    def test_translations_obsolete(self):
        locale_dir = self.test_dir.joinpath('locale_obsolete')
        self.assertEqual(os.listdir(locale_dir), ['zordon.po'])
        for language in updater.SUPPORTED_LANGUAGES:
            locale_dir.joinpath(language).mkdir(parents=True)
            shutil.copyfile(locale_dir.joinpath('zordon.po'), locale_dir.joinpath(language, 'zordon.po'))

        instance = updater.TranslationsUpdater(locale_dir, self.test_dir.joinpath('source'))
        self.assertFalse(instance.is_translations_generated())
        self.assertTrue(instance.regenerate_all())

        for language in updater.SUPPORTED_LANGUAGES:
            shutil.rmtree(locale_dir.joinpath(language))
Exemplo n.º 3
0
 def test_all_release_strings_are_valid(self):
     instance = updater.TranslationsUpdater(APP_DIR.joinpath('i18n'), APP_DIR)
     self.assertTrue(instance.regenerate_all())
     self.assertTrue(instance.is_translations_generated())