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