|
|
|
@ -1,27 +1,10 @@
|
|
|
|
|
!(function () { |
|
|
|
|
var i18nStore = {}; |
|
|
|
|
var i18nWidgets = {}; |
|
|
|
|
_.extend(BI, { |
|
|
|
|
i18nProvider: { |
|
|
|
|
addWidget: function (widget, i18n) { |
|
|
|
|
if (!i18nWidgets[widget.getName()]) { |
|
|
|
|
i18nWidgets[widget.getName()] = i18n; |
|
|
|
|
i18n.widget = widget; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
removeWidget: function (widget) { |
|
|
|
|
if (i18nWidgets[widget.getName()]) { |
|
|
|
|
delete i18nWidgets[widget.getName()]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
changeI18n: function (i18n) { |
|
|
|
|
if (i18n) { |
|
|
|
|
i18nStore = i18n; |
|
|
|
|
} |
|
|
|
|
BI.each(i18nWidgets, function (widgetName, i18n) { |
|
|
|
|
i18n.widget.setText(BI.i18nText.apply(null, i18n.args)); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
addI18n: function (i18n) { |
|
|
|
|
BI.extend(i18nStore, i18n); |
|
|
|
@ -46,18 +29,7 @@
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return { |
|
|
|
|
args: arguments, |
|
|
|
|
addWidget: function (widget) { |
|
|
|
|
BI.i18nProvider.addWidget(widget, this); |
|
|
|
|
}, |
|
|
|
|
valueOf: function () { |
|
|
|
|
return localeText; |
|
|
|
|
}, |
|
|
|
|
toString: function () { |
|
|
|
|
return localeText; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
return localeText; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
})(); |
|
|
|
|