From bf1e026b647a198b6cacf2a0b932ebe05ba10547 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 27 Aug 2021 09:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81i18n=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 - src/base/single/1.text.js | 4 ---- src/core/utils/i18n.js | 30 +----------------------------- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/changelog.md b/changelog.md index 75f0e66b1..8c8bb9ba5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,5 @@ # 更新日志 2.0(2021-07) -- 支持BI.changeI18n动态换i18n方法 - layout支持forceUpdate刷新方式 - width属性支持calc() - 修改了颜色选择器交互 diff --git a/src/base/single/1.text.js b/src/base/single/1.text.js index 65aa03712..2fc5adfb7 100644 --- a/src/base/single/1.text.js +++ b/src/base/single/1.text.js @@ -106,9 +106,6 @@ _getShowText: function () { var o = this.options; var text = BI.isFunction(o.text) ? o.text() : o.text; - if (text && text.addWidget) { - text.addWidget(this); - } return BI.isKey(text) ? BI.Text.formatText(text + "") : text; }, @@ -158,7 +155,6 @@ __d: function () { BI.Text.superclass.__d.call(this); - BI.i18nProvider.removeWidget(this); } }); var formatters = []; diff --git a/src/core/utils/i18n.js b/src/core/utils/i18n.js index f725ad666..0dbf0a1a9 100644 --- a/src/core/utils/i18n.js +++ b/src/core/utils/i18n.js @@ -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; } }); })();