From e526f3df818ea21760c5eeb4e2f728845bb93140 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 21 Aug 2013 12:55:52 -0400 Subject: continue work on i18n --- unrpyc/Makefile | 4 ++++ unrpyc/decompiler.py | 12 +++++------- unrpyc/find-gzip.sh | 12 +++++------- www/index.html | 4 ++-- www/js/html5ks.js | 6 ++---- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/unrpyc/Makefile b/unrpyc/Makefile index 826f1e3..829d2b9 100644 --- a/unrpyc/Makefile +++ b/unrpyc/Makefile @@ -13,6 +13,10 @@ script.json: $(patsubst %.rpyc,%.json,$(wildcard script-*.rpyc)) %.json: %.json.o node fix.js $< $@ +ui-strings.json.o: ui-strings.rpyc *.py + python unrpyc.py --clobber $< $@ + sed -i -e 's/ \["init_language", "en", \],//;s/^\]}$$/}/' $@ + %.json.o: %.rpyc *.py python unrpyc.py --clobber $< $@ diff --git a/unrpyc/decompiler.py b/unrpyc/decompiler.py index 95aebf7..ee55ef1 100644 --- a/unrpyc/decompiler.py +++ b/unrpyc/decompiler.py @@ -274,14 +274,12 @@ class PrintRenPython(python_ast.NodeVisitor): return '"%s"' % node.attr def visit_Assign(self, node): - if not isinstance(node.targets[0], python_ast.Subscript): - if isinstance(node.targets[0], python_ast.Name): - id = node.targets[0].id - if id == 'suppress_window_after_timeskip' or id == '_window': - return - else: + if isinstance(node.targets[0], python_ast.Subscript): return - print(python_ast.dump(node)) + if isinstance(node.targets[0], python_ast.Name): + id = node.targets[0].id + if id == 'suppress_window_before_timeskip' or id == 'suppress_window_after_timeskip' or id == '_window': + return self.f.write(self.visit(node.targets[0])) self.f.write(': ') self.f.write(self.visit(node.value)) diff --git a/unrpyc/find-gzip.sh b/unrpyc/find-gzip.sh index 2ee9064..cb65dc9 100755 --- a/unrpyc/find-gzip.sh +++ b/unrpyc/find-gzip.sh @@ -1,13 +1,11 @@ #!/bin/sh -ZOPFLI="$(command -v zopfli)" -GZIP="$(command -v gzip)" -if [ -n $ZOPFLI ]; then - echo "$ZOPFLI" -elif [ -n $GZIP ]; then +if command -v zopfli; then + printf "%s" "$(command -v zopfli)" +elif command -v gzip; then echo >&2 "Consider obtaining zopfli (https://code.google.com/p/zopfli/)" echo >&2 "for higher compression ratios (about 5% decrease in size of" - echo >&2 "script.json.gz." - echo "$GZIP -9" + echo >&2 "script.json.gz)." + printf "%s" "$(command -v gzip) -9" else echo >&2 "Could not find zopfli or gzip, aborting." exit 1 diff --git a/www/index.html b/www/index.html index cbd4a18..bc4de59 100644 --- a/www/index.html +++ b/www/index.html @@ -62,8 +62,8 @@
diff --git a/www/js/html5ks.js b/www/js/html5ks.js index ff3fc18..74ab43b 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -1,8 +1,6 @@ "use strict"; window.html5ks = { - data: { - script: {} - }, + data: {}, persistent: {}, init: function () { var defaultPersistent = { @@ -211,13 +209,13 @@ window.html5ks = { } this.api.init(); this.menu.init(); + this.i18n.init(); if (this.persistent.fullscreen) { document.body.addEventListener("click", function onclick() { this.removeEventListener("click", onclick, false); html5ks.fullscreen(); }, false); } - this.i18n.init(); }, start: function () { this.fetch("json", "script").then(function () { -- cgit v1.2.3-70-g09d2