1 namespace("kivi", function(ns) {
3 ns._localeLang = false;
6 ns.t8 = function(text, params) {
8 if( !ns._locales[ns._localeLang] ) {
9 ns._locales[ns._localeLang] = {};
12 url: "js/locale/"+ ns._localeLang +".js",
15 success: function(res) {
16 ns._locales[ns._localeLang] = res;
21 text = ns._locales[ns._localeLang][text] || text;
24 if( Object.prototype.toString.call( params ) === '[object Array]' ) {
25 var len = params.length;
27 for(var i=0; i<len; ++i) {
29 var value = params[i];
30 text = text.split("#"+ key).join(value);
33 else if( typeof params == 'object' ) {
34 for(var key in params) {
35 var value = params[key];
36 text = text.split("#{"+ key +"}").join(value);
43 ns.initLocale = function(localeLang) {
44 ns._localeLang = localeLang;