diff --git a/selfdrive/ui/tests/test_translations.py b/selfdrive/ui/tests/test_translations.py index ae91dd6f83..526dde93e8 100755 --- a/selfdrive/ui/tests/test_translations.py +++ b/selfdrive/ui/tests/test_translations.py @@ -32,9 +32,6 @@ class TestTranslations(unittest.TestCase): def test_missing_translation_files(self): for name, file in self.translation_files.items(): with self.subTest(name=name, file=file): - if not len(file): - self.skipTest(f"{name} translation has no defined file") - self.assertTrue(os.path.exists(os.path.join(TRANSLATIONS_DIR, f"{file}.ts")), f"{name} has no XML translation file, run selfdrive/ui/update_translations.py") @@ -43,9 +40,6 @@ class TestTranslations(unittest.TestCase): for name, file in self.translation_files.items(): with self.subTest(name=name, file=file): - if not len(file): - self.skipTest(f"{name} translation has no defined file") - # caught by test_missing_translation_files if not os.path.exists(os.path.join(TRANSLATIONS_DIR, f"{file}.ts")): self.skipTest(f"{name} missing translation file") @@ -59,13 +53,17 @@ class TestTranslations(unittest.TestCase): def test_unfinished_translations(self): for name, file in self.translation_files.items(): with self.subTest(name=name, file=file): - if not len(file): - raise self.skipTest(f"{name} translation has no defined file") - cur_translations = self._read_translation_file(TRANSLATIONS_DIR, file) self.assertTrue(b"" not in cur_translations, f"{file} ({name}) translation file has unfinished translations. Finish translations or mark them as completed in Qt Linguist") + def test_vanished_translations(self): + for name, file in self.translation_files.items(): + with self.subTest(name=name, file=file): + cur_translations = self._read_translation_file(TRANSLATIONS_DIR, file) + self.assertTrue(b"" not in cur_translations, + f"{file} ({name}) translation file has obsolete translations. Run selfdrive/ui/update_translations.py --vanish to remove them") + if __name__ == "__main__": unittest.main() diff --git a/selfdrive/ui/translations/create_badges.py b/selfdrive/ui/translations/create_badges.py index 58b587462f..d9e2d443b9 100755 --- a/selfdrive/ui/translations/create_badges.py +++ b/selfdrive/ui/translations/create_badges.py @@ -17,9 +17,6 @@ if __name__ == "__main__": print("Copy into selfdrive/ui/translations/README.md:\n") for name, file in translation_files.items(): - if not len(file): - continue - with open(os.path.join(TRANSLATIONS_DIR, f"{file}.ts"), "r") as tr_f: tr_file = tr_f.read() diff --git a/selfdrive/ui/update_translations.py b/selfdrive/ui/update_translations.py index 78c973c86b..3a278b4812 100755 --- a/selfdrive/ui/update_translations.py +++ b/selfdrive/ui/update_translations.py @@ -18,10 +18,6 @@ def update_translations(vanish=False, plural_only=None, translations_dir=TRANSLA translation_files = json.load(f) for name, file in translation_files.items(): - if not len(file): - print(f"{name} has no translation file, skipping...") - continue - tr_file = os.path.join(translations_dir, f"{file}.ts") args = f"lupdate -recursive {UI_DIR} -ts {tr_file}" if vanish: