diff -r 2f44412c520b .hgignore
--- a/.hgignore Sat Jun 20 23:42:23 2015 +0200
+++ b/.hgignore Sun Sep 20 14:33:47 2015 +0200
@@ -26,6 +26,7 @@
users.dat
projects.dat
rights.dat
+openttd_lang
# Files created by Mac image preview and file browser:
.DS_Store
diff -r 2f44412c520b scripts/filter_update_langs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/filter_update_langs Sun Sep 20 14:33:47 2015 +0200
@@ -0,0 +1,134 @@
+#!/usr/bin/env python3
+
+import sys, os, os.path, getopt
+
+
+
+# Keywords to use from OpenTTD langfiles
+filterkeywords = [ "##name", "##ownname", "##isocode", "##plural", "##grflangid", "##gender", "##case" ]
+
+
+
+def filter_langfile(filename):
+ """
+ Read and filter OpenTTD lang file for required keywords.
+
+ @param filename: File to read.
+ @type filename: C{str}
+
+ @return: List of keywords lines.
+ @rtype: C{list} of C{str}
+ """
+ result = []
+ for l in open(filename, 'r', encoding = 'utf-8'):
+ l = l.strip()
+ if len(l) == 0:
+ continue
+
+ if not l.startswith("#"):
+ break
+
+ if not l.startswith("##"):
+ continue
+
+ if any(l.startswith(key) for key in filterkeywords):
+ result.append(l)
+
+ return result
+
+def read_complete_langfile(filename):
+ """
+ Read complete file.
+
+ @param filename: File to read.
+ @type filename: C{str}
+
+ @return: List of lines.
+ @rtype: C{list} of C{str}
+ """
+ return list([ l.strip() for l in open(filename, 'r', encoding = 'utf-8') ])
+
+def write_langfile(filename, content):
+ """
+ Writes complete file.
+
+ @param filename: File to write.
+ @type filename: C{str}
+
+ @param content: List of lines.
+ @type content: C{list} of C{str}
+ """
+ with open(filename, "w", encoding = 'utf-8') as f:
+ f.write("\n".join(content))
+ f.write("\n")
+
+
+
+# Parse arguments
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "h", [ "help" ])
+except getopt.GetoptError as err:
+ print("filter_update_langs: " + str(err) + " (try \"filter_update_langs -h\")")
+ sys.exit(2)
+
+# Check arguments
+for opt, val in opts:
+ if opt in ('--help', '-h'):
+ print("Usage: filter_update_langs