Comparing version 3.0.7 to 3.0.8
@@ -35,3 +35,3 @@ "use strict"; | ||
const lan = (0, exports.getLocale)(); | ||
const intl = window.intl; | ||
const intl = window.intl || {}; | ||
if (!tags || tags.length === 0) { | ||
@@ -42,12 +42,14 @@ await superagent_1.default.get(`/intl/${lan}.json`).then((res) => { | ||
} | ||
await Promise.all(tags.map(tag => superagent_1.default.get(`/intl/${lan}-${tag}.json`) | ||
.then((res) => { | ||
return res.body; | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
return {}; | ||
}))).then((arr) => { | ||
window.intl = Object.assign(intl, ...arr); | ||
}); | ||
else { | ||
await Promise.all(tags.map(tag => superagent_1.default.get(`/intl/${lan}-${tag}.json`) | ||
.then((res) => { | ||
return res.body; | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
return {}; | ||
}))).then((arr) => { | ||
window.intl = Object.assign(intl, ...(arr || [])); | ||
}); | ||
} | ||
}; | ||
@@ -54,0 +56,0 @@ exports.getIntlMessage = getIntlMessage; |
@@ -86,3 +86,3 @@ "use strict"; | ||
lan = (0, exports.getLocale)(); | ||
intl = window.intl; | ||
intl = window.intl || {}; | ||
if (!(!tags || tags.length === 0)) return [3 /*break*/, 2]; | ||
@@ -94,3 +94,3 @@ return [4 /*yield*/, superagent_1.default.get("/intl/".concat(lan, ".json")).then(function (res) { | ||
_a.sent(); | ||
_a.label = 2; | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, Promise.all(tags.map(function (tag) { | ||
@@ -106,7 +106,8 @@ return superagent_1.default.get("/intl/".concat(lan, "-").concat(tag, ".json")) | ||
})).then(function (arr) { | ||
window.intl = Object.assign.apply(Object, __spreadArray([intl], arr, false)); | ||
window.intl = Object.assign.apply(Object, __spreadArray([intl], (arr || []), false)); | ||
})]; | ||
case 3: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
_a.label = 4; | ||
case 4: return [2 /*return*/]; | ||
} | ||
@@ -113,0 +114,0 @@ }); |
{ | ||
"name": "tant-intl", | ||
"version": "3.0.7", | ||
"version": "3.0.8", | ||
"description": "依托于飞书表格做文案管理的多语言组件", | ||
@@ -5,0 +5,0 @@ "main": "es/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
21170
418