aboutsummaryrefslogtreecommitdiff
path: root/tools/translate.py
diff options
context:
space:
mode:
authorIrving Gonzalez <ialexis93@gmail.com>2015-07-27 21:57:11 -0600
committerIrving Gonzalez <ialexis93@gmail.com>2015-07-27 21:57:11 -0600
commitc4f6471ee18b97130e85efd488b5d102a1935366 (patch)
tree946ae514f8669c78b748b2ee54fc9e8c1ef144ac /tools/translate.py
parentd6c53e951c5cdb4e03a30705f4f922b9b37fd7a6 (diff)
parente4248b9acf6caac111c881bc9a05bbfc58d2d0a1 (diff)
downloadtrackermap-server-c4f6471ee18b97130e85efd488b5d102a1935366.tar.gz
trackermap-server-c4f6471ee18b97130e85efd488b5d102a1935366.tar.bz2
trackermap-server-c4f6471ee18b97130e85efd488b5d102a1935366.zip
Merge branch 'master' of https://github.com/tananaev/traccar
Diffstat (limited to 'tools/translate.py')
-rwxr-xr-xtools/translate.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/translate.py b/tools/translate.py
new file mode 100755
index 000000000..69c55979b
--- /dev/null
+++ b/tools/translate.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+
+import re
+import os
+
+path = '../web/l10n/'
+
+files = [f for f in os.listdir(path) if os.path.isfile(path + f) and f.endswith('.js') and not f.endswith('en.js')]
+for f in files:
+ f = path + f
+
+ dict = {}
+
+ for line in open(f).read().splitlines():
+ match = re.search(" (\\w+): '(.+)'(,)?", line)
+ if match:
+ dict[match.group(1)] = match.group(2)
+
+ out = open(f, 'w')
+
+ for line in open(path + 'en.js').read().splitlines():
+ match = re.search(" (\\w+): '(.+)'(,)?", line)
+ if match:
+ if dict.has_key(match.group(1)):
+ value = dict[match.group(1)]
+ else:
+ value = match.group(2) + ' (*)'
+
+ out.write(' ' + match.group(1) + ": '" + value + "'")
+ if match.group(3) is not None:
+ out.write(',')
+ out.write('\n')
+ else:
+ out.write(line + '\n')