1 namespace("kivi", function(ns) {
3 ns._localeLang = false;
6 ns.t8 = function(text, params) {
8 if( !ns._locales[ns._localeLang] ) {
10 url: "locale/"+ ns._localeLang +"/js.js",
13 success: function(res) {
14 ns._locales[ns._localeLang] = res;
16 error: function(xhr, textStatus, errorThrown) {
17 alert(textStatus +": "+ errorThrown);
22 text = ns._locales[ns._localeLang][text] || text;
25 if( Object.prototype.toString.call( params ) === '[object Array]' ) {
26 var len = params.length;
28 for(var i=0; i<len; ++i) {
30 var value = params[i];
31 text = text.split("#"+ key).join(value);
34 else if( typeof params == 'object' ) {
35 for(var key in params) {
36 var value = params[key];
37 text = text.split("#{"+ key +"}").join(value);
44 ns.initLocale = function(localeLang) {
45 ns._localeLang = localeLang;