var I18n = (function () { function I18n() { this.enable = false; } I18n.prototype.init = function (dir,lang) { //console.log('dir-->',dir); var _this = this; if (this.enable) return _this; $.i18n.properties({ name: 'i18n', path: 'bundle/' + dir + '/', mode: 'both', language: lang, async: true, callback: function () { $('.i18n').each(function () { var key = $(this).attr('i18n'); //console.log('key-->',key); var val = _this.getValue(key); $(this).html(val); //console.log('value-->',val); }); } }); $('body').show(); return _this; }; I18n.prototype.getValue = function (key) { if (this.enable) return "mag:i18n not open."; return $.i18n.prop(key); }; return I18n; }());