Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Check for unused translations (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelarnauts authored Apr 20, 2020
1 parent b33062b commit 78bfae2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 0 additions & 12 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand All @@ -42,10 +38,6 @@ msgctxt "#30013"
msgid "TV guide"
msgstr ""

msgctxt "#30014"
msgid "Browse the TV Guide"
msgstr ""


### SUBMENUS
msgctxt "#30053"
Expand Down Expand Up @@ -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 ""
Expand Down
12 changes: 0 additions & 12 deletions resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
28 changes: 28 additions & 0 deletions tests/check_for_unused_translations.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 78bfae2

Please sign in to comment.