From: Wolfram Schneider Date: Fri, 21 Jun 2013 09:27:50 +0000 (+0000) Subject: create locale language menu X-Git-Tag: 0.9.1~571 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=3ae9e3ba0a56b63a0ed0c0e5b5339279519c59c5;p=mkws-moved-to-github.git create locale language menu --- diff --git a/experiments/spclient/index.html b/experiments/spclient/index.html index fd9699d..e879fa1 100644 --- a/experiments/spclient/index.html +++ b/experiments/spclient/index.html @@ -23,6 +23,7 @@
+
diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 80b5b7a..12f8a2d 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -446,6 +446,7 @@ function mkws_html_all(data) { } mkws_set_lang(mkws_config); + mkws_html_lang(mkws_config); // For some reason, doing this programmatically results in // document.search.query being undefined, hence the raw HTML. @@ -580,6 +581,33 @@ function mkws_service_proxy_auth(auth_url) { }); } +/* create locale language menu */ +function mkws_html_lang(mkws_config) { + var lang_default = "en"; + var lang = mkws_config.lang || lang_default; + var list = [lang_default]; + + for (var k in mkws_locale_lang) { + list.push(k); + } + + var data = ""; + for(var i = 0; i < list.length; i++) { + var l = list[i]; + + if (data) + data += ' | '; + + if (lang == l) { + data += l; + } else { + data += ' ' + l + ' ' + } + } + + $("#mkwsLang").html(data); +} + /* locale */ function M(word) { var lang = jQuery.parseQuerystring().lang || mkws_config.lang;