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

Commit 78bfae2

Browse files
Check for unused translations (#24)
1 parent b33062b commit 78bfae2

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ check-translations:
3131
@$(foreach lang,$(languages), \
3232
msgcmp resources/language/resource.language.$(lang)/strings.po resources/language/resource.language.en_gb/strings.po; \
3333
)
34+
@tests/check_for_unused_translations.py
3435

3536
check-addon: clean build
3637
@echo ">>> Running addon checks"

resources/language/resource.language.en_gb/strings.po

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ msgctxt "#30003"
1818
msgid "Catalogue"
1919
msgstr ""
2020

21-
msgctxt "#30004"
22-
msgid "TV Shows and Movies listed by category"
23-
msgstr ""
24-
2521
msgctxt "#30007"
2622
msgid "Channels"
2723
msgstr ""
@@ -42,10 +38,6 @@ msgctxt "#30013"
4238
msgid "TV guide"
4339
msgstr ""
4440

45-
msgctxt "#30014"
46-
msgid "Browse the TV Guide"
47-
msgstr ""
48-
4941

5042
### SUBMENUS
5143
msgctxt "#30053"
@@ -144,10 +136,6 @@ msgctxt "#30713"
144136
msgid "The requested video was not found in the guide."
145137
msgstr ""
146138

147-
msgctxt "#30714"
148-
msgid "Local metadata is cleared."
149-
msgstr ""
150-
151139
msgctxt "#30715"
152140
msgid "Updating metadata"
153141
msgstr ""

resources/language/resource.language.nl_nl/strings.po

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ msgctxt "#30003"
1919
msgid "Catalogue"
2020
msgstr "Catalogus"
2121

22-
msgctxt "#30004"
23-
msgid "TV Shows and Movies listed by category"
24-
msgstr "Programma's en films per categorie"
25-
2622
msgctxt "#30007"
2723
msgid "Channels"
2824
msgstr "Kanalen"
@@ -43,10 +39,6 @@ msgctxt "#30013"
4339
msgid "TV guide"
4440
msgstr "Tv-gids"
4541

46-
msgctxt "#30014"
47-
msgid "Browse the TV Guide"
48-
msgstr "Doorblader de tv-gids"
49-
5042

5143
### SUBMENUS
5244
msgctxt "#30053"
@@ -145,10 +137,6 @@ msgctxt "#30713"
145137
msgid "The requested video was not found in the guide."
146138
msgstr "De gevraagde video werd niet gevonden in de tv-gids."
147139

148-
msgctxt "#30714"
149-
msgid "Local metadata is cleared."
150-
msgstr "De lokale metadata is verwijderd."
151-
152140
msgctxt "#30715"
153141
msgid "Updating metadata"
154142
msgstr "Vernieuwen metadata"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
""" Quick and dirty way to check if all translations might be used. """
4+
5+
# pylint: disable=invalid-name,superfluous-parens
6+
7+
import subprocess
8+
import sys
9+
10+
import polib
11+
12+
error = 0
13+
14+
# Load all python code from git
15+
code = subprocess.check_output(['git', 'grep', '', '--', 'resources/*.py', 'resources/settings.xml']).decode('utf-8')
16+
17+
# Load po file
18+
po = polib.pofile('resources/language/resource.language.en_gb/strings.po')
19+
for entry in po:
20+
# Extract msgctxt
21+
msgctxt = entry.msgctxt.lstrip('#')
22+
23+
if msgctxt not in code:
24+
print('No usage found for translation:')
25+
print(entry)
26+
error = 1
27+
28+
sys.exit(error)

0 commit comments

Comments
 (0)