@daoyi/nmtl-ui 2.0.1-beta.107 → 2.0.1-beta.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -267,9 +267,15 @@ var getIntl = function getIntl() {
|
|
|
267
267
|
getLocale: function getLocale() {
|
|
268
268
|
return lang;
|
|
269
269
|
},
|
|
270
|
-
|
|
270
|
+
/* 支援 {var} 佔位符代入(R30):原本只查表不代入,
|
|
271
|
+
「第 {page} 頁」會被報讀軟體直接唸成「第page頁」 */
|
|
272
|
+
formatMessage: function formatMessage(_ref, values) {
|
|
271
273
|
var id = _ref.id;
|
|
272
|
-
|
|
274
|
+
var message = (languages[lang] || zhtw)[id] || id;
|
|
275
|
+
if (!values) return message;
|
|
276
|
+
return message.replace(/\{(\w+)\}/g, function (match, key) {
|
|
277
|
+
return values[key] === undefined ? match : String(values[key]);
|
|
278
|
+
});
|
|
273
279
|
}
|
|
274
280
|
};
|
|
275
281
|
};
|
package/package.json
CHANGED