Browse Source

Pull request #2132: 无JIRA任务 支持i18n动态换i18n方法

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit 'da97b6be0b91cc839098de4860daffd73850cab3':
  整理代码
  支持i18n变化
  支持i18n动态换i18n方法
es6
guy 3 years ago
parent
commit
ef570ced85
  1. 3
      src/base/single/0.single.js
  2. 7
      src/base/single/1.text.js
  3. 7
      src/core/utils/i18n.js

3
src/base/single/0.single.js

@ -196,7 +196,8 @@ BI.Single = BI.inherit(BI.Widget, {
return this.options.value; return this.options.value;
}, },
destroyed: function () { __d: function () {
BI.Single.superclass.__d.call(this);
if (BI.isNotNull(this.showTimeout)) { if (BI.isNotNull(this.showTimeout)) {
clearTimeout(this.showTimeout); clearTimeout(this.showTimeout);
this.showTimeout = null; this.showTimeout = null;

7
src/base/single/1.text.js

@ -45,13 +45,13 @@
}); });
} }
if (BI.isWidthOrHeight(o.height)) { if (BI.isWidthOrHeight(o.height)) {
this.element.css({ lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height }); this.element.css({lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height});
} }
if (BI.isWidthOrHeight(o.lineHeight)) { if (BI.isWidthOrHeight(o.lineHeight)) {
this.element.css({ lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight }); this.element.css({lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight});
} }
if (BI.isWidthOrHeight(o.maxWidth)) { if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({ maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth }); this.element.css({maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth});
} }
this.element.css({ this.element.css({
textAlign: o.textAlign, textAlign: o.textAlign,
@ -106,7 +106,6 @@
_getShowText: function () { _getShowText: function () {
var o = this.options; var o = this.options;
var text = BI.isFunction(o.text) ? o.text() : o.text; var text = BI.isFunction(o.text) ? o.text() : o.text;
return BI.isKey(text) ? BI.Text.formatText(text + "") : text; return BI.isKey(text) ? BI.Text.formatText(text + "") : text;
}, },

7
src/core/utils/i18n.js

@ -1,6 +1,11 @@
!(function () { !(function () {
var i18nStore = {}; var i18nStore = {};
_.extend(BI, { _.extend(BI, {
changeI18n: function (i18n) {
if (i18n) {
i18nStore = i18n;
}
},
addI18n: function (i18n) { addI18n: function (i18n) {
BI.extend(i18nStore, i18n); BI.extend(i18nStore, i18n);
}, },
@ -27,4 +32,4 @@
return localeText; return localeText;
} }
}); });
})(); })();

Loading…
Cancel
Save