Fix several bits of bad i18n markup and add start of checking script.
[dcpomatic.git] / hacks / check_i18n
diff --git a/hacks/check_i18n b/hacks/check_i18n
new file mode 100644 (file)
index 0000000..b07c0ad
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/bin/python3
+
+import os
+
+for (dirpath, dirs, files) in os.walk('.'):
+    for filename in files:
+        if filename.endswith('.po'):
+            with open(os.path.join(dirpath, filename), 'r') as f:
+                for l in f.readlines():
+                    # Pango markup with corrupted quotation marks
+                    if l.find('span') != -1 and (l.find('«') != -1 or l.find('“') != -1):
+                        print(os.path.join(dirpath, filename))
+                        print(l)
+                    # Badly-spaced placeholders
+                    if not l.find('%%') and (l.find('% 1') != -1 or l.find('% 2') != -1 or l.find('% s') != -1 or l.find('% d') != -1 or l.find('% f') != -1):
+                        print(os.path.join(dirpath, filename))
+                        print(l)