Check for unused translations (#24)

This commit is contained in:
Michaël Arnauts 2020-04-20 16:09:00 +02:00 committed by GitHub
parent b33062bd35
commit 78bfae2471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 24 deletions

View File

@ -31,6 +31,7 @@ check-translations:
@$(foreach lang,$(languages), \
msgcmp resources/language/resource.language.$(lang)/strings.po resources/language/resource.language.en_gb/strings.po; \
)
@tests/check_for_unused_translations.py
check-addon: clean build
@echo ">>> Running addon checks"

View File

@ -18,10 +18,6 @@ msgctxt "#30003"
msgid "Catalogue"
msgstr ""
msgctxt "#30004"
msgid "TV Shows and Movies listed by category"
msgstr ""
msgctxt "#30007"
msgid "Channels"
msgstr ""
@ -42,10 +38,6 @@ msgctxt "#30013"
msgid "TV guide"
msgstr ""
msgctxt "#30014"
msgid "Browse the TV Guide"
msgstr ""
### SUBMENUS
msgctxt "#30053"
@ -144,10 +136,6 @@ msgctxt "#30713"
msgid "The requested video was not found in the guide."
msgstr ""
msgctxt "#30714"
msgid "Local metadata is cleared."
msgstr ""
msgctxt "#30715"
msgid "Updating metadata"
msgstr ""

View File

@ -19,10 +19,6 @@ msgctxt "#30003"
msgid "Catalogue"
msgstr "Catalogus"
msgctxt "#30004"
msgid "TV Shows and Movies listed by category"
msgstr "Programma's en films per categorie"
msgctxt "#30007"
msgid "Channels"
msgstr "Kanalen"
@ -43,10 +39,6 @@ msgctxt "#30013"
msgid "TV guide"
msgstr "Tv-gids"
msgctxt "#30014"
msgid "Browse the TV Guide"
msgstr "Doorblader de tv-gids"
### SUBMENUS
msgctxt "#30053"
@ -145,10 +137,6 @@ msgctxt "#30713"
msgid "The requested video was not found in the guide."
msgstr "De gevraagde video werd niet gevonden in de tv-gids."
msgctxt "#30714"
msgid "Local metadata is cleared."
msgstr "De lokale metadata is verwijderd."
msgctxt "#30715"
msgid "Updating metadata"
msgstr "Vernieuwen metadata"

View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Quick and dirty way to check if all translations might be used. """
# pylint: disable=invalid-name,superfluous-parens
import subprocess
import sys
import polib
error = 0
# Load all python code from git
code = subprocess.check_output(['git', 'grep', '', '--', 'resources/*.py', 'resources/settings.xml']).decode('utf-8')
# Load po file
po = polib.pofile('resources/language/resource.language.en_gb/strings.po')
for entry in po:
# Extract msgctxt
msgctxt = entry.msgctxt.lstrip('#')
if msgctxt not in code:
print('No usage found for translation:')
print(entry)
error = 1
sys.exit(error)