From 42d3384d26dd64f1dd50921c14980fb415d8a398 Mon Sep 17 00:00:00 2001 From: Dailer Date: Fri, 21 Sep 2018 16:48:43 +0800 Subject: [PATCH] =?UTF-8?q?CORE-127=20=20=E7=AE=80=E5=8C=96=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=9B=BD=E9=99=85=E5=8C=96=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/base.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/base.js b/src/core/base.js index c2d647424..46714bfc3 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -43,14 +43,11 @@ if (!_global.BI) { if (!localeText) { localeText = key; } - var len = arguments.length; - var regexp = new RegExp("\\{\\s*\\}"); - if (len > 1) { - for (var i = 1; i < len; i++) { - localeText = localeText.replace(regexp, arguments[i] + ""); - } - } - return localeText; + var args = Array.prototype.slice.call(arguments); + var count = 1; + return BI.replaceAll(localeText, "\\{\\s*\\}", function () { + return args[count++] + ""; + }); }, assert: function (v, is) {