Use pofilter to check i18n and fix some .po file glitches.
[dcpomatic.git] / hacks / check_i18n
index b07c0ad17ddf88ca6f3daaac7f8eb528b745509d..d0c7edee8e2a8e8255af9562dc5828f6ab396189 100644 (file)
@@ -1,17 +1,15 @@
-#!/usr/bin/python3
+#!/bin/bash
 
-import os
+mkdir -p errors
 
-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)
+pofilter -i src/lib/po -o errors/lib --nofuzzy \
+    -t escapes -t nplurals -t printf -t pythonbraceformat -t variables -t xmltags \
+    -t accelerators
+
+pofilter -i src/wx/po -o errors/wx --nofuzzy \
+    -t escapes -t nplurals -t printf -t pythonbraceformat -t variables -t xmltags \
+    -t accelerators
+
+pofilter -i src/tools/po -o errors/tools --nofuzzy \
+    -t escapes -t nplurals -t printf -t pythonbraceformat -t variables -t xmltags \
+    -t accelerators