X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/c6ab4d998bb67369edaa4141a89d1c06c42a7e15..224291ddfd1633e2e3a47632cca24c1039fcb105:/js/kivi.js diff --git a/js/kivi.js b/js/kivi.js new file mode 100644 index 000000000..db9904b53 --- /dev/null +++ b/js/kivi.js @@ -0,0 +1,48 @@ +namespace("kivi", function(ns) { + + ns._localeLang = false; + ns._locales = {}; + + ns.t8 = function(text, params) { + if( ns._localeLang ) { + if( !ns._locales[ns._localeLang] ) { + jQuery.ajax({ + url: "locale/"+ ns._localeLang +"/js.js", + async: false, + dataType: "json", + success: function(res) { + ns._locales[ns._localeLang] = res; + }, + error: function(xhr, textStatus, errorThrown) { + alert(textStatus +": "+ errorThrown); + }, + }); + } + + text = ns._locales[ns._localeLang][text] || text; + } + + if( Object.prototype.toString.call( params ) === '[object Array]' ) { + var len = params.length; + + for(var i=0; i