From e4c006b866a6d9b0ea34e7cfd8e3510168f535a6 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 20 Aug 2013 13:14:03 -0400 Subject: work on i18n --- www/js/html5ks.js | 1 + www/js/i18n.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'www/js') 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); + } + } + }); + } +}; -- cgit v1.2.3-70-g09d2