[PATCH] Added script to find unused i18n in *.java and *.xml files
Wald Commits
scm-commit at wald.intevation.org
Thu Jun 19 18:31:56 CEST 2014
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1403194839 -7200
# Node ID 26971f97105fe02978ac018ef9ffb33171d03014
# Parent ed37ba0511035c8b6858cb90813c7517dd9a219b
Added script to find unused i18n in *.java and *.xml files.
diff -r ed37ba051103 -r 26971f97105f artifacts/contrib/find-obsolete-i18n-strings.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/contrib/find-obsolete-i18n-strings.py Thu Jun 19 18:20:39 2014 +0200
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+import os
+import re
+import sys
+
+KEY_RE = re.compile(r"^\s*([^\s=]+)\s*=.*$")
+
+def main():
+ content = []
+ for root, dirs, files in os.walk('.'):
+ for f in files:
+ if not (f.endswith(".java") or f.endswith(".xml")):
+ continue
+ p = os.path.join(root, f)
+ with open(p, "rb") as jf:
+ content.append(jf.read())
+
+ content = ''.join(content)
+
+ for arg in sys.argv[1:]:
+ with open(arg, "rb") as prop:
+ for line in prop:
+ m = KEY_RE.match(line)
+ if not m:
+ continue
+ key = m.group(1)
+ if content.find(key) == -1:
+ print key
+
+if __name__ == "__main__":
+ main()
More information about the Dive4Elements-commits
mailing list