diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2013-08-20 13:14:03 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2013-08-20 13:14:03 -0400 |
commit | e4c006b866a6d9b0ea34e7cfd8e3510168f535a6 (patch) | |
tree | 1a4a46c4c5f7cfb9f1a58b0e6196b5b7bbdcabba | |
parent | f5a6c301cc9a277f024563ea656f3fe49aa89834 (diff) | |
download | html5ks-e4c006b866a6d9b0ea34e7cfd8e3510168f535a6.tar.xz html5ks-e4c006b866a6d9b0ea34e7cfd8e3510168f535a6.zip |
work on i18n
-rw-r--r-- | unrpyc/decompiler.py | 4 | ||||
-rw-r--r-- | www/index.html | 1 | ||||
-rw-r--r-- | www/js/html5ks.js | 1 | ||||
-rw-r--r-- | www/js/i18n.js | 15 |
4 files changed, 20 insertions, 1 deletions
diff --git a/unrpyc/decompiler.py b/unrpyc/decompiler.py index 38fbd52..9180098 100644 --- a/unrpyc/decompiler.py +++ b/unrpyc/decompiler.py @@ -327,6 +327,10 @@ class PrintRenPython(python_ast.NodeVisitor): def visit_keyword(self, node): return self.visit(node.value) + def visit(self, node): + self.f.write(python_ast.dump(node)) + return super().visit(node) + def print_Python(f, stmt, indent_level, early=False): code_src = stmt.code.source diff --git a/www/index.html b/www/index.html index 6a44ab4..cbd4a18 100644 --- a/www/index.html +++ b/www/index.html @@ -24,6 +24,7 @@ <script src="js/images.js"></script> <script src="js/characters.js"></script> <script src="js/imachine.js"></script> + <script src="js/i18n.js"></script> </head> <body><div id="all" style="height: 100%; position: absolute; width: 100%;"> <div id="warn-container"> diff --git a/www/js/html5ks.js b/www/js/html5ks.js index aea03b1..ff3fc18 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -217,6 +217,7 @@ window.html5ks = { html5ks.fullscreen(); }, false); } + this.i18n.init(); }, start: function () { this.fetch("json", "script").then(function () { diff --git a/www/js/i18n.js b/www/js/i18n.js index 764a0dd..427d9b3 100644 --- a/www/js/i18n.js +++ b/www/js/i18n.js @@ -1,2 +1,15 @@ +"use strict"; html5ks.i18n = { - + init: function () { + html5ks.fetch("json", "ui-strings").then(function () { + var uiStrings = html5ks.data["ui-strings"]; + for (var k in uiStrings) { + var e = document.getElementsByClassName(k); + for (var i = e.length - 1; i >= 0; i--) { + var t = document.createTextNode(uiStrings[k]); + e[i].appendChild(t); + } + } + }); + } +}; |