aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-18 11:40:46 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-18 11:40:46 +1200
commit2608adeff46f1286deff11a5320cee5647f6d41b (patch)
treea16014c04c755ec701b3237b0cccc7d8cc406960 /tools
parentd5ca160059220a07c71c95cc85696e0d66bf9c6e (diff)
downloadetbsa-traccar-web-2608adeff46f1286deff11a5320cee5647f6d41b.tar.gz
etbsa-traccar-web-2608adeff46f1286deff11a5320cee5647f6d41b.tar.bz2
etbsa-traccar-web-2608adeff46f1286deff11a5320cee5647f6d41b.zip
Move web interface from main repo
Diffstat (limited to 'tools')
-rw-r--r--tools/minify.bat5
-rwxr-xr-xtools/minify.sh14
-rwxr-xr-xtools/translate.py35
3 files changed, 54 insertions, 0 deletions
diff --git a/tools/minify.bat b/tools/minify.bat
new file mode 100644
index 0000000..6ab8fd9
--- /dev/null
+++ b/tools/minify.bat
@@ -0,0 +1,5 @@
+@echo off
+cd C:\[traccar path]\traccar\web
+set SDK=C:\[sencha path]\ext-6.0.0
+
+sencha -sdk %SDK% compile -classpath=app.js,app,%SDK%\packages\core\src,%SDK%\packages\core\overrides,%SDK%\classic\classic\src,%SDK%\classic\classic\overrides exclude -all and include -recursive -file app.js and exclude -namespace=Ext and concatenate -closure app.min.js
diff --git a/tools/minify.sh b/tools/minify.sh
new file mode 100755
index 0000000..4a5c47f
--- /dev/null
+++ b/tools/minify.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+cd $(dirname $0)/../web
+
+SDK="../../ext-6.0.1"
+
+sencha compile --classpath=app.js,app,$SDK/packages/core/src,$SDK/packages/core/overrides,$SDK/classic/classic/src,$SDK/classic/classic/overrides \
+ exclude -all \
+ and \
+ include -recursive -file app.js \
+ and \
+ exclude -namespace=Ext \
+ and \
+ concatenate -closure app.min.js
diff --git a/tools/translate.py b/tools/translate.py
new file mode 100755
index 0000000..e8324a6
--- /dev/null
+++ b/tools/translate.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+import os
+import optparse
+import urllib2
+import json
+import base64
+
+parser = optparse.OptionParser()
+parser.add_option("-u", "--user", dest="username", help="transifex user login")
+parser.add_option("-p", "--password", dest="password", help="transifex user password")
+
+(options, args) = parser.parse_args()
+
+if not options.username or not options.password:
+ parser.error('User name and password are required')
+
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+
+path = "../web/l10n/"
+
+def request(url):
+ req = urllib2.Request(url)
+ auth = base64.encodestring("%s:%s" % (options.username, options.password)).replace("\n", "")
+ req.add_header("Authorization", "Basic %s" % auth)
+ return urllib2.urlopen(req)
+
+resource = json.load(request("https://www.transifex.com/api/2/project/traccar/resource/web/?details"))
+
+for language in resource["available_languages"]:
+ code = language["code"]
+ data = request("https://www.transifex.com/api/2/project/traccar/resource/web/translation/" + code + "?file")
+ file = open(path + code + ".json", "wb")
+ file.write(data.read())
+ file.close()