|
|
@ -32,9 +32,6 @@ class TestTranslations(unittest.TestCase): |
|
|
|
def test_missing_translation_files(self): |
|
|
|
def test_missing_translation_files(self): |
|
|
|
for name, file in self.translation_files.items(): |
|
|
|
for name, file in self.translation_files.items(): |
|
|
|
with self.subTest(name=name, file=file): |
|
|
|
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")), |
|
|
|
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") |
|
|
|
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(): |
|
|
|
for name, file in self.translation_files.items(): |
|
|
|
with self.subTest(name=name, file=file): |
|
|
|
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 |
|
|
|
# caught by test_missing_translation_files |
|
|
|
if not os.path.exists(os.path.join(TRANSLATIONS_DIR, f"{file}.ts")): |
|
|
|
if not os.path.exists(os.path.join(TRANSLATIONS_DIR, f"{file}.ts")): |
|
|
|
self.skipTest(f"{name} missing translation file") |
|
|
|
self.skipTest(f"{name} missing translation file") |
|
|
@ -59,13 +53,17 @@ class TestTranslations(unittest.TestCase): |
|
|
|
def test_unfinished_translations(self): |
|
|
|
def test_unfinished_translations(self): |
|
|
|
for name, file in self.translation_files.items(): |
|
|
|
for name, file in self.translation_files.items(): |
|
|
|
with self.subTest(name=name, file=file): |
|
|
|
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) |
|
|
|
cur_translations = self._read_translation_file(TRANSLATIONS_DIR, file) |
|
|
|
self.assertTrue(b"<translation type=\"unfinished\">" not in cur_translations, |
|
|
|
self.assertTrue(b"<translation type=\"unfinished\">" not in cur_translations, |
|
|
|
f"{file} ({name}) translation file has unfinished translations. Finish translations or mark them as completed in Qt Linguist") |
|
|
|
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"<translation type=\"vanished\">" 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__": |
|
|
|
if __name__ == "__main__": |
|
|
|
unittest.main() |
|
|
|
unittest.main() |
|
|
|