@spscommerce/i18n 8.12.0 → 8.12.2
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.
- package/lib/index.es.js +71 -134
- package/package.json +2 -2
package/lib/index.es.js
CHANGED
|
@@ -24,13 +24,11 @@ function I(a) {
|
|
|
24
24
|
}, I(a);
|
|
25
25
|
}
|
|
26
26
|
function Lt(a, t) {
|
|
27
|
-
if (I(a) != "object" || !a)
|
|
28
|
-
return a;
|
|
27
|
+
if (I(a) != "object" || !a) return a;
|
|
29
28
|
var n = a[Symbol.toPrimitive];
|
|
30
29
|
if (n !== void 0) {
|
|
31
30
|
var e = n.call(a, t);
|
|
32
|
-
if (I(e) != "object")
|
|
33
|
-
return e;
|
|
31
|
+
if (I(e) != "object") return e;
|
|
34
32
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
35
33
|
}
|
|
36
34
|
return String(a);
|
|
@@ -59,8 +57,7 @@ function D(a) {
|
|
|
59
57
|
return a;
|
|
60
58
|
}
|
|
61
59
|
function H(a, t) {
|
|
62
|
-
if (!(a instanceof t))
|
|
63
|
-
throw new TypeError("Cannot call a class as a function");
|
|
60
|
+
if (!(a instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
64
61
|
}
|
|
65
62
|
function De(a, t) {
|
|
66
63
|
for (var n = 0; n < t.length; n++) {
|
|
@@ -74,15 +71,12 @@ function M(a, t, n) {
|
|
|
74
71
|
}), a;
|
|
75
72
|
}
|
|
76
73
|
function W(a) {
|
|
77
|
-
if (a === void 0)
|
|
78
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
74
|
+
if (a === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
79
75
|
return a;
|
|
80
76
|
}
|
|
81
77
|
function ee(a, t) {
|
|
82
|
-
if (t && (I(t) == "object" || typeof t == "function"))
|
|
83
|
-
|
|
84
|
-
if (t !== void 0)
|
|
85
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
78
|
+
if (t && (I(t) == "object" || typeof t == "function")) return t;
|
|
79
|
+
if (t !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
|
|
86
80
|
return W(a);
|
|
87
81
|
}
|
|
88
82
|
function G(a) {
|
|
@@ -96,8 +90,7 @@ function Le(a, t) {
|
|
|
96
90
|
}, Le(a, t);
|
|
97
91
|
}
|
|
98
92
|
function ve(a, t) {
|
|
99
|
-
if (typeof t != "function" && t !== null)
|
|
100
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
93
|
+
if (typeof t != "function" && t !== null) throw new TypeError("Super expression must either be null or a function");
|
|
101
94
|
a.prototype = Object.create(t && t.prototype, {
|
|
102
95
|
constructor: {
|
|
103
96
|
value: a,
|
|
@@ -246,8 +239,7 @@ function Ae(a, t, n) {
|
|
|
246
239
|
return !a || typeof a == "string";
|
|
247
240
|
}
|
|
248
241
|
for (var i = typeof t != "string" ? [].concat(t) : t.split("."); i.length > 1; ) {
|
|
249
|
-
if (r())
|
|
250
|
-
return {};
|
|
242
|
+
if (r()) return {};
|
|
251
243
|
var o = e(i.shift());
|
|
252
244
|
!a[o] && n && (a[o] = new n()), Object.prototype.hasOwnProperty.call(a, o) ? a = a[o] : a = {};
|
|
253
245
|
}
|
|
@@ -433,8 +425,7 @@ var me = typeof window < "u" && window.navigator && window.navigator.userAgent &
|
|
|
433
425
|
key: "translate",
|
|
434
426
|
value: function(e, r, i) {
|
|
435
427
|
var o = this;
|
|
436
|
-
if (I(r) !== "object" && this.options.overloadTranslationOptionHandler && (r = this.options.overloadTranslationOptionHandler(arguments)), r || (r = {}), e == null)
|
|
437
|
-
return "";
|
|
428
|
+
if (I(r) !== "object" && this.options.overloadTranslationOptionHandler && (r = this.options.overloadTranslationOptionHandler(arguments)), r || (r = {}), e == null) return "";
|
|
438
429
|
Array.isArray(e) || (e = [String(e)]);
|
|
439
430
|
var s = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator, u = this.extractFromKey(e[e.length - 1], r), f = u.key, c = u.namespaces, p = c[c.length - 1], v = r.lng || this.language, m = r.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
440
431
|
if (v && v.toLowerCase() === "cimode") {
|
|
@@ -477,8 +468,7 @@ var me = typeof window < "u" && window.navigator && window.navigator.userAgent &
|
|
|
477
468
|
if (this.options.saveMissingTo === "fallback" && B && B[0])
|
|
478
469
|
for (var X = 0; X < B.length; X++)
|
|
479
470
|
_.push(B[X]);
|
|
480
|
-
else
|
|
481
|
-
this.options.saveMissingTo === "all" ? _ = this.languageUtils.toResolveHierarchy(r.lng || this.language) : _.push(r.lng || this.language);
|
|
471
|
+
else this.options.saveMissingTo === "all" ? _ = this.languageUtils.toResolveHierarchy(r.lng || this.language) : _.push(r.lng || this.language);
|
|
482
472
|
var Te = function(J, be, Fe) {
|
|
483
473
|
o.options.missingKeyHandler ? o.options.missingKeyHandler(J, p, be, P ? Fe : g, P, r) : o.backendConnector && o.backendConnector.saveMissing && o.backendConnector.saveMissing(J, p, be, P ? Fe : g, P, r), o.emit("missingKey", J, p, be, g);
|
|
484
474
|
};
|
|
@@ -593,16 +583,14 @@ var Ft = function() {
|
|
|
593
583
|
return M(a, [{
|
|
594
584
|
key: "getScriptPartFromCode",
|
|
595
585
|
value: function(n) {
|
|
596
|
-
if (!n || n.indexOf("-") < 0)
|
|
597
|
-
return null;
|
|
586
|
+
if (!n || n.indexOf("-") < 0) return null;
|
|
598
587
|
var e = n.split("-");
|
|
599
588
|
return e.length === 2 || (e.pop(), e[e.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(e.join("-"));
|
|
600
589
|
}
|
|
601
590
|
}, {
|
|
602
591
|
key: "getLanguagePartFromCode",
|
|
603
592
|
value: function(n) {
|
|
604
|
-
if (!n || n.indexOf("-") < 0)
|
|
605
|
-
return n;
|
|
593
|
+
if (!n || n.indexOf("-") < 0) return n;
|
|
606
594
|
var e = n.split("-");
|
|
607
595
|
return this.formatLanguageCode(e[0]);
|
|
608
596
|
}
|
|
@@ -631,8 +619,7 @@ var Ft = function() {
|
|
|
631
619
|
key: "getBestMatchFromCodes",
|
|
632
620
|
value: function(n) {
|
|
633
621
|
var e = this;
|
|
634
|
-
if (!n)
|
|
635
|
-
return null;
|
|
622
|
+
if (!n) return null;
|
|
636
623
|
var r;
|
|
637
624
|
return n.forEach(function(i) {
|
|
638
625
|
if (!r) {
|
|
@@ -642,11 +629,9 @@ var Ft = function() {
|
|
|
642
629
|
}), !r && this.options.supportedLngs && n.forEach(function(i) {
|
|
643
630
|
if (!r) {
|
|
644
631
|
var o = e.getLanguagePartFromCode(i);
|
|
645
|
-
if (e.isSupportedCode(o))
|
|
646
|
-
return r = o;
|
|
632
|
+
if (e.isSupportedCode(o)) return r = o;
|
|
647
633
|
r = e.options.supportedLngs.find(function(s) {
|
|
648
|
-
if (s.indexOf(o) === 0)
|
|
649
|
-
return s;
|
|
634
|
+
if (s.indexOf(o) === 0) return s;
|
|
650
635
|
});
|
|
651
636
|
}
|
|
652
637
|
}), r || (r = this.getFallbackCodes(this.options.fallbackLng)[0]), r;
|
|
@@ -654,12 +639,9 @@ var Ft = function() {
|
|
|
654
639
|
}, {
|
|
655
640
|
key: "getFallbackCodes",
|
|
656
641
|
value: function(n, e) {
|
|
657
|
-
if (!n)
|
|
658
|
-
|
|
659
|
-
if (
|
|
660
|
-
return n;
|
|
661
|
-
if (!e)
|
|
662
|
-
return n.default || [];
|
|
642
|
+
if (!n) return [];
|
|
643
|
+
if (typeof n == "function" && (n = n(e)), typeof n == "string" && (n = [n]), Object.prototype.toString.apply(n) === "[object Array]") return n;
|
|
644
|
+
if (!e) return n.default || [];
|
|
663
645
|
var r = n[e];
|
|
664
646
|
return r || (r = n[this.getScriptPartFromCode(e)]), r || (r = n[this.formatLanguageCode(e)]), r || (r = n[this.getLanguagePartFromCode(e)]), r || (r = n.default), r || [];
|
|
665
647
|
}
|
|
@@ -966,8 +948,7 @@ var Ut = function() {
|
|
|
966
948
|
continue;
|
|
967
949
|
} else
|
|
968
950
|
o.logger.warn("missed to pass in variable ".concat(s[1], " for interpolating ").concat(n)), u = "";
|
|
969
|
-
else
|
|
970
|
-
typeof u != "string" && !o.useRawValueToEscape && (u = Ie(u));
|
|
951
|
+
else typeof u != "string" && !o.useRawValueToEscape && (u = Ie(u));
|
|
971
952
|
if (n = n.replace(s[0], g.safeValue(u)), g.regex.lastIndex = 0, f++, f >= o.maxReplaces)
|
|
972
953
|
break;
|
|
973
954
|
}
|
|
@@ -980,8 +961,7 @@ var Ut = function() {
|
|
|
980
961
|
u.applyPostProcessor = !1, delete u.defaultValue;
|
|
981
962
|
function f(m, d) {
|
|
982
963
|
var y = this.nestingOptionsSeparator;
|
|
983
|
-
if (m.indexOf(y) < 0)
|
|
984
|
-
return m;
|
|
964
|
+
if (m.indexOf(y) < 0) return m;
|
|
985
965
|
var g = m.split(new RegExp("".concat(y, "[ ]*{"))), b = "{".concat(g[1]);
|
|
986
966
|
m = g[0], b = this.interpolate(b, u), b = b.replace(/'/g, '"');
|
|
987
967
|
try {
|
|
@@ -999,8 +979,7 @@ var Ut = function() {
|
|
|
999
979
|
});
|
|
1000
980
|
o[1] = v.shift(), c = v, p = !0;
|
|
1001
981
|
}
|
|
1002
|
-
if (s = e(f.call(this, o[1].trim(), u), u), s && o[0] === n && typeof s != "string")
|
|
1003
|
-
return s;
|
|
982
|
+
if (s = e(f.call(this, o[1].trim(), u), u), s && o[0] === n && typeof s != "string") return s;
|
|
1004
983
|
typeof s != "string" && (s = Ie(s)), s || (this.logger.warn("missed to resolve ".concat(o[1], " for nesting ").concat(n)), s = ""), p && (s = c.reduce(function(m, d) {
|
|
1005
984
|
return r.format(m, d, i.lng, i);
|
|
1006
985
|
}, s.trim())), n = n.replace(o[0], s), this.regexp.lastIndex = 0;
|
|
@@ -1256,8 +1235,7 @@ var Vt = function(a) {
|
|
|
1256
1235
|
var y = function(b, S) {
|
|
1257
1236
|
e.isInitialized && e.logger.warn("init: i18next is already initialized. You should call init just once!"), e.isInitialized = !0, e.options.isClone || e.logger.log("initialized", e.options), e.emit("initialized", e.options), v.resolve(S), i(b, S);
|
|
1258
1237
|
};
|
|
1259
|
-
if (e.languages && e.options.compatibilityAPI !== "v1" && !e.isInitialized)
|
|
1260
|
-
return y(null, e.t.bind(e));
|
|
1238
|
+
if (e.languages && e.options.compatibilityAPI !== "v1" && !e.isInitialized) return y(null, e.t.bind(e));
|
|
1261
1239
|
e.changeLanguage(e.options.lng, y);
|
|
1262
1240
|
};
|
|
1263
1241
|
return this.options.resources || !this.options.initImmediate ? m() : setTimeout(m, 0), v;
|
|
@@ -1267,8 +1245,7 @@ var Vt = function(a) {
|
|
|
1267
1245
|
value: function(e) {
|
|
1268
1246
|
var r = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : re, o = i, s = typeof e == "string" ? e : this.language;
|
|
1269
1247
|
if (typeof e == "function" && (o = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1270
|
-
if (s && s.toLowerCase() === "cimode")
|
|
1271
|
-
return o();
|
|
1248
|
+
if (s && s.toLowerCase() === "cimode") return o();
|
|
1272
1249
|
var u = [], f = function(v) {
|
|
1273
1250
|
if (v) {
|
|
1274
1251
|
var m = r.services.languageUtils.toResolveHierarchy(v);
|
|
@@ -1302,10 +1279,8 @@ var Vt = function(a) {
|
|
|
1302
1279
|
}, {
|
|
1303
1280
|
key: "use",
|
|
1304
1281
|
value: function(e) {
|
|
1305
|
-
if (!e)
|
|
1306
|
-
|
|
1307
|
-
if (!e.type)
|
|
1308
|
-
throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1282
|
+
if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1283
|
+
if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1309
1284
|
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && st.addPostProcessor(e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1310
1285
|
}
|
|
1311
1286
|
}, {
|
|
@@ -1370,16 +1345,14 @@ var Vt = function(a) {
|
|
|
1370
1345
|
if (!this.languages || !this.languages.length)
|
|
1371
1346
|
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1372
1347
|
var o = this.languages[0], s = this.options ? this.options.fallbackLng : !1, u = this.languages[this.languages.length - 1];
|
|
1373
|
-
if (o.toLowerCase() === "cimode")
|
|
1374
|
-
return !0;
|
|
1348
|
+
if (o.toLowerCase() === "cimode") return !0;
|
|
1375
1349
|
var f = function(v, m) {
|
|
1376
1350
|
var d = r.services.backendConnector.state["".concat(v, "|").concat(m)];
|
|
1377
1351
|
return d === -1 || d === 2;
|
|
1378
1352
|
};
|
|
1379
1353
|
if (i.precheck) {
|
|
1380
1354
|
var c = i.precheck(this, f);
|
|
1381
|
-
if (c !== void 0)
|
|
1382
|
-
return c;
|
|
1355
|
+
if (c !== void 0) return c;
|
|
1383
1356
|
}
|
|
1384
1357
|
return !!(this.hasResourceBundle(o, e) || !this.services.backendConnector.backend || f(o, e) && (!s || f(u, e)));
|
|
1385
1358
|
}
|
|
@@ -1408,8 +1381,7 @@ var Vt = function(a) {
|
|
|
1408
1381
|
}, {
|
|
1409
1382
|
key: "dir",
|
|
1410
1383
|
value: function(e) {
|
|
1411
|
-
if (e || (e = this.languages && this.languages.length > 0 ? this.languages[0] : this.language), !e)
|
|
1412
|
-
return "rtl";
|
|
1384
|
+
if (e || (e = this.languages && this.languages.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
|
|
1413
1385
|
var r = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam"];
|
|
1414
1386
|
return r.indexOf(this.services.languageUtils.getLanguagePartFromCode(e)) >= 0 ? "rtl" : "ltr";
|
|
1415
1387
|
}
|
|
@@ -1440,25 +1412,20 @@ var Vt = function(a) {
|
|
|
1440
1412
|
}]), t;
|
|
1441
1413
|
}(z), $t = new Vt();
|
|
1442
1414
|
function Kt(a, t) {
|
|
1443
|
-
if (a == null)
|
|
1444
|
-
return {};
|
|
1415
|
+
if (a == null) return {};
|
|
1445
1416
|
var n = {};
|
|
1446
|
-
for (var e in a)
|
|
1447
|
-
if (
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
n[e] = a[e];
|
|
1451
|
-
}
|
|
1417
|
+
for (var e in a) if ({}.hasOwnProperty.call(a, e)) {
|
|
1418
|
+
if (t.indexOf(e) >= 0) continue;
|
|
1419
|
+
n[e] = a[e];
|
|
1420
|
+
}
|
|
1452
1421
|
return n;
|
|
1453
1422
|
}
|
|
1454
1423
|
function ut(a, t) {
|
|
1455
|
-
if (a == null)
|
|
1456
|
-
return {};
|
|
1424
|
+
if (a == null) return {};
|
|
1457
1425
|
var n, e, r = Kt(a, t);
|
|
1458
1426
|
if (Object.getOwnPropertySymbols) {
|
|
1459
1427
|
var i = Object.getOwnPropertySymbols(a);
|
|
1460
|
-
for (e = 0; e < i.length; e++)
|
|
1461
|
-
n = i[e], t.indexOf(n) >= 0 || {}.propertyIsEnumerable.call(a, n) && (r[n] = a[n]);
|
|
1428
|
+
for (e = 0; e < i.length; e++) n = i[e], t.indexOf(n) >= 0 || {}.propertyIsEnumerable.call(a, n) && (r[n] = a[n]);
|
|
1462
1429
|
}
|
|
1463
1430
|
return r;
|
|
1464
1431
|
}
|
|
@@ -1490,13 +1457,10 @@ function qe(a) {
|
|
|
1490
1457
|
var e = a.indexOf("-->");
|
|
1491
1458
|
return { type: "comment", comment: e !== -1 ? a.slice(4, e) : "" };
|
|
1492
1459
|
}
|
|
1493
|
-
for (var r = new RegExp(Xt), i = null; (i = r.exec(a)) !== null; )
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
o.indexOf("=") > -1 && (s = o.split("=")), t.attrs[s[0]] = s[1], r.lastIndex--;
|
|
1498
|
-
} else
|
|
1499
|
-
i[2] && (t.attrs[i[2]] = i[3].trim().substring(1, i[3].length - 1));
|
|
1460
|
+
for (var r = new RegExp(Xt), i = null; (i = r.exec(a)) !== null; ) if (i[0].trim()) if (i[1]) {
|
|
1461
|
+
var o = i[1].trim(), s = [o, ""];
|
|
1462
|
+
o.indexOf("=") > -1 && (s = o.split("=")), t.attrs[s[0]] = s[1], r.lastIndex--;
|
|
1463
|
+
} else i[2] && (t.attrs[i[2]] = i[3].trim().substring(1, i[3].length - 1));
|
|
1500
1464
|
return t;
|
|
1501
1465
|
}
|
|
1502
1466
|
var Jt = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, Qt = /^\s*$/, Gt = /* @__PURE__ */ Object.create(null);
|
|
@@ -1507,8 +1471,7 @@ function lt(a, t) {
|
|
|
1507
1471
|
case "tag":
|
|
1508
1472
|
return a += "<" + t.name + (t.attrs ? function(n) {
|
|
1509
1473
|
var e = [];
|
|
1510
|
-
for (var r in n)
|
|
1511
|
-
e.push(r + '="' + n[r] + '"');
|
|
1474
|
+
for (var r in n) e.push(r + '="' + n[r] + '"');
|
|
1512
1475
|
return e.length ? " " + e.join(" ") : "";
|
|
1513
1476
|
}(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? a : a + t.children.reduce(lt, "") + "</" + t.name + ">";
|
|
1514
1477
|
case "comment":
|
|
@@ -1524,8 +1487,7 @@ var Yt = { parse: function(a, t) {
|
|
|
1524
1487
|
}
|
|
1525
1488
|
return a.replace(Jt, function(u, f) {
|
|
1526
1489
|
if (o) {
|
|
1527
|
-
if (u !== "</" + n.name + ">")
|
|
1528
|
-
return;
|
|
1490
|
+
if (u !== "</" + n.name + ">") return;
|
|
1529
1491
|
o = !1;
|
|
1530
1492
|
}
|
|
1531
1493
|
var c, p = u.charAt(1) !== "/", v = u.startsWith("<!--"), m = f + u.length, d = a.charAt(m);
|
|
@@ -1667,8 +1629,7 @@ function ze(a, t, n) {
|
|
|
1667
1629
|
}
|
|
1668
1630
|
function un(a, t) {
|
|
1669
1631
|
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, e = t.languages[0], r = t.options ? t.options.fallbackLng : !1, i = t.languages[t.languages.length - 1];
|
|
1670
|
-
if (e.toLowerCase() === "cimode")
|
|
1671
|
-
return !0;
|
|
1632
|
+
if (e.toLowerCase() === "cimode") return !0;
|
|
1672
1633
|
var o = function(u, f) {
|
|
1673
1634
|
var c = t.services.backendConnector.state["".concat(u, "|").concat(f)];
|
|
1674
1635
|
return c === -1 || c === 2;
|
|
@@ -1682,8 +1643,7 @@ function fn(a, t) {
|
|
|
1682
1643
|
var e = t.options.ignoreJSONStructure !== void 0;
|
|
1683
1644
|
return e ? t.hasLoadedNamespace(a, {
|
|
1684
1645
|
precheck: function(i, o) {
|
|
1685
|
-
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && i.services.backendConnector.backend && i.isLanguageChangingTo && !o(i.isLanguageChangingTo, a))
|
|
1686
|
-
return !1;
|
|
1646
|
+
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && i.services.backendConnector.backend && i.isLanguageChangingTo && !o(i.isLanguageChangingTo, a)) return !1;
|
|
1687
1647
|
}
|
|
1688
1648
|
}) : un(a, t, n);
|
|
1689
1649
|
}
|
|
@@ -1710,8 +1670,7 @@ function F(a) {
|
|
|
1710
1670
|
return a;
|
|
1711
1671
|
}
|
|
1712
1672
|
function Se(a, t) {
|
|
1713
|
-
if (!a)
|
|
1714
|
-
return !1;
|
|
1673
|
+
if (!a) return !1;
|
|
1715
1674
|
var n = a.props ? a.props.children : a.children;
|
|
1716
1675
|
return t ? n.length > 0 : !!n;
|
|
1717
1676
|
}
|
|
@@ -1731,8 +1690,7 @@ function dn(a, t) {
|
|
|
1731
1690
|
return n.props = Object.assign(a.props, t.props), n;
|
|
1732
1691
|
}
|
|
1733
1692
|
function gt(a, t) {
|
|
1734
|
-
if (!a)
|
|
1735
|
-
return "";
|
|
1693
|
+
if (!a) return "";
|
|
1736
1694
|
var n = "", e = Z(a), r = t.transSupportBasicHtmlNodes && t.transKeepBasicHtmlNodesFor ? t.transKeepBasicHtmlNodesFor : [];
|
|
1737
1695
|
return e.forEach(function(i, o) {
|
|
1738
1696
|
if (typeof i == "string")
|
|
@@ -1765,11 +1723,9 @@ function gt(a, t) {
|
|
|
1765
1723
|
}), n;
|
|
1766
1724
|
}
|
|
1767
1725
|
function hn(a, t, n, e, r, i) {
|
|
1768
|
-
if (t === "")
|
|
1769
|
-
return [];
|
|
1726
|
+
if (t === "") return [];
|
|
1770
1727
|
var o = e.transKeepBasicHtmlNodesFor || [], s = t && new RegExp(o.join("|")).test(t);
|
|
1771
|
-
if (!a && !s)
|
|
1772
|
-
return [t];
|
|
1728
|
+
if (!a && !s) return [t];
|
|
1773
1729
|
var u = {};
|
|
1774
1730
|
function f(g) {
|
|
1775
1731
|
var b = Z(g);
|
|
@@ -1833,12 +1789,11 @@ function hn(a, t, n, e, r, i) {
|
|
|
1833
1789
|
else if (I(L) === "object" && !E) {
|
|
1834
1790
|
var _ = w.children[0] ? R : null;
|
|
1835
1791
|
_ && k.push(_);
|
|
1836
|
-
} else
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
})));
|
|
1792
|
+
} else w.children.length === 1 && R ? k.push(ne(L, F(F({}, L.props), {}, {
|
|
1793
|
+
key: j
|
|
1794
|
+
}), R)) : k.push(ne(L, F(F({}, L.props), {}, {
|
|
1795
|
+
key: j
|
|
1796
|
+
})));
|
|
1842
1797
|
} else if (w.type === "text") {
|
|
1843
1798
|
var B = e.transWrapTextNodes, X = i ? e.unescape(n.services.interpolator.interpolate(w.content, p, n.language)) : n.services.interpolator.interpolate(w.content, p, n.language);
|
|
1844
1799
|
B ? k.push(ie(B, {
|
|
@@ -1878,26 +1833,21 @@ function gn(a) {
|
|
|
1878
1833
|
return l ? ie(l, y, U) : U;
|
|
1879
1834
|
}
|
|
1880
1835
|
function vn(a) {
|
|
1881
|
-
if (Array.isArray(a))
|
|
1882
|
-
return a;
|
|
1836
|
+
if (Array.isArray(a)) return a;
|
|
1883
1837
|
}
|
|
1884
1838
|
function mn(a, t) {
|
|
1885
1839
|
var n = a == null ? null : typeof Symbol < "u" && a[Symbol.iterator] || a["@@iterator"];
|
|
1886
1840
|
if (n != null) {
|
|
1887
1841
|
var e, r, i, o, s = [], u = !0, f = !1;
|
|
1888
1842
|
try {
|
|
1889
|
-
if (i = (n = n.call(a)).next, t !== 0)
|
|
1890
|
-
for (; !(u = (e = i.call(n)).done) && (s.push(e.value), s.length !== t); u = !0)
|
|
1891
|
-
;
|
|
1843
|
+
if (i = (n = n.call(a)).next, t !== 0) for (; !(u = (e = i.call(n)).done) && (s.push(e.value), s.length !== t); u = !0) ;
|
|
1892
1844
|
} catch (c) {
|
|
1893
1845
|
f = !0, r = c;
|
|
1894
1846
|
} finally {
|
|
1895
1847
|
try {
|
|
1896
|
-
if (!u && n.return != null && (o = n.return(), Object(o) !== o))
|
|
1897
|
-
return;
|
|
1848
|
+
if (!u && n.return != null && (o = n.return(), Object(o) !== o)) return;
|
|
1898
1849
|
} finally {
|
|
1899
|
-
if (f)
|
|
1900
|
-
throw r;
|
|
1850
|
+
if (f) throw r;
|
|
1901
1851
|
}
|
|
1902
1852
|
}
|
|
1903
1853
|
return s;
|
|
@@ -1905,14 +1855,12 @@ function mn(a, t) {
|
|
|
1905
1855
|
}
|
|
1906
1856
|
function Xe(a, t) {
|
|
1907
1857
|
(t == null || t > a.length) && (t = a.length);
|
|
1908
|
-
for (var n = 0, e = Array(t); n < t; n++)
|
|
1909
|
-
e[n] = a[n];
|
|
1858
|
+
for (var n = 0, e = Array(t); n < t; n++) e[n] = a[n];
|
|
1910
1859
|
return e;
|
|
1911
1860
|
}
|
|
1912
1861
|
function yn(a, t) {
|
|
1913
1862
|
if (a) {
|
|
1914
|
-
if (typeof a == "string")
|
|
1915
|
-
return Xe(a, t);
|
|
1863
|
+
if (typeof a == "string") return Xe(a, t);
|
|
1916
1864
|
var n = {}.toString.call(a).slice(8, -1);
|
|
1917
1865
|
return n === "Object" && a.constructor && (n = a.constructor.name), n === "Map" || n === "Set" ? Array.from(a) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Xe(a, t) : void 0;
|
|
1918
1866
|
}
|
|
@@ -1991,8 +1939,7 @@ function On(a) {
|
|
|
1991
1939
|
k.current && !w.current && S(d), w.current = !1;
|
|
1992
1940
|
}, [o, p]);
|
|
1993
1941
|
var j = [b, o, m];
|
|
1994
|
-
if (j.t = b, j.i18n = o, j.ready = m, m || !m && !c)
|
|
1995
|
-
return j;
|
|
1942
|
+
if (j.t = b, j.i18n = o, j.ready = m, m || !m && !c) return j;
|
|
1996
1943
|
throw new Promise(function(R) {
|
|
1997
1944
|
ze(o, v, function() {
|
|
1998
1945
|
R();
|
|
@@ -2334,17 +2281,15 @@ var Ne = function(t, n) {
|
|
|
2334
2281
|
var e = "";
|
|
2335
2282
|
for (var r in n)
|
|
2336
2283
|
e += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(n[r]);
|
|
2337
|
-
if (!e)
|
|
2338
|
-
return t;
|
|
2284
|
+
if (!e) return t;
|
|
2339
2285
|
t = t + (t.indexOf("?") !== -1 ? "&" : "?") + e.slice(1);
|
|
2340
2286
|
}
|
|
2341
2287
|
return t;
|
|
2342
2288
|
}, Ye = function(t, n, e) {
|
|
2343
2289
|
$(t, n).then(function(r) {
|
|
2344
|
-
if (!r.ok)
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
});
|
|
2290
|
+
if (!r.ok) return e(r.statusText || "Error", {
|
|
2291
|
+
status: r.status
|
|
2292
|
+
});
|
|
2348
2293
|
r.text().then(function(i) {
|
|
2349
2294
|
e(null, {
|
|
2350
2295
|
status: r.status,
|
|
@@ -2469,8 +2414,7 @@ var In = function() {
|
|
|
2469
2414
|
value: function(n, e, r, i, o) {
|
|
2470
2415
|
var s = this, u = this.options.loadPath;
|
|
2471
2416
|
typeof this.options.loadPath == "function" && (u = this.options.loadPath(n, r)), u = Ln(u), u.then(function(f) {
|
|
2472
|
-
if (!f)
|
|
2473
|
-
return o(null, {});
|
|
2417
|
+
if (!f) return o(null, {});
|
|
2474
2418
|
var c = s.services.interpolator.interpolate(f, {
|
|
2475
2419
|
lng: n.join("+"),
|
|
2476
2420
|
ns: r.join("+")
|
|
@@ -2483,22 +2427,17 @@ var In = function() {
|
|
|
2483
2427
|
value: function(n, e, r, i) {
|
|
2484
2428
|
var o = this;
|
|
2485
2429
|
this.options.request(this.options, n, void 0, function(s, u) {
|
|
2486
|
-
if (u && (u.status >= 500 && u.status < 600 || !u.status))
|
|
2487
|
-
|
|
2488
|
-
if (u &&
|
|
2489
|
-
|
|
2490
|
-
if (!u && s && s.message && s.message.indexOf("Failed to fetch") > -1)
|
|
2491
|
-
return e("failed loading " + n + ": " + s.message, !0);
|
|
2492
|
-
if (s)
|
|
2493
|
-
return e(s, !1);
|
|
2430
|
+
if (u && (u.status >= 500 && u.status < 600 || !u.status)) return e("failed loading " + n + "; status code: " + u.status, !0);
|
|
2431
|
+
if (u && u.status >= 400 && u.status < 500) return e("failed loading " + n + "; status code: " + u.status, !1);
|
|
2432
|
+
if (!u && s && s.message && s.message.indexOf("Failed to fetch") > -1) return e("failed loading " + n + ": " + s.message, !0);
|
|
2433
|
+
if (s) return e(s, !1);
|
|
2494
2434
|
var f, c;
|
|
2495
2435
|
try {
|
|
2496
2436
|
typeof u.data == "string" ? f = o.options.parse(u.data, r, i) : f = u.data;
|
|
2497
2437
|
} catch {
|
|
2498
2438
|
c = "failed parsing " + n + " to json";
|
|
2499
2439
|
}
|
|
2500
|
-
if (c)
|
|
2501
|
-
return e(c, !1);
|
|
2440
|
+
if (c) return e(c, !1);
|
|
2502
2441
|
e(null, f);
|
|
2503
2442
|
});
|
|
2504
2443
|
}
|
|
@@ -2561,8 +2500,7 @@ var et = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Hn = function(t, n, e) {
|
|
|
2561
2500
|
var i = encodeURIComponent(n), o = t + "=" + i;
|
|
2562
2501
|
if (r.maxAge > 0) {
|
|
2563
2502
|
var s = r.maxAge - 0;
|
|
2564
|
-
if (isNaN(s))
|
|
2565
|
-
throw new Error("maxAge should be a Number");
|
|
2503
|
+
if (isNaN(s)) throw new Error("maxAge should be a Number");
|
|
2566
2504
|
o += "; Max-Age=" + Math.floor(s);
|
|
2567
2505
|
}
|
|
2568
2506
|
if (r.domain) {
|
|
@@ -2612,8 +2550,7 @@ var et = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Hn = function(t, n, e) {
|
|
|
2612
2550
|
for (var n = t + "=", e = document.cookie.split(";"), r = 0; r < e.length; r++) {
|
|
2613
2551
|
for (var i = e[r]; i.charAt(0) === " "; )
|
|
2614
2552
|
i = i.substring(1, i.length);
|
|
2615
|
-
if (i.indexOf(n) === 0)
|
|
2616
|
-
return i.substring(n.length, i.length);
|
|
2553
|
+
if (i.indexOf(n) === 0) return i.substring(n.length, i.length);
|
|
2617
2554
|
}
|
|
2618
2555
|
return null;
|
|
2619
2556
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/i18n",
|
|
3
3
|
"description": "SPS Design System React components",
|
|
4
|
-
"version": "8.12.
|
|
4
|
+
"version": "8.12.2",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/i18n",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
|
42
42
|
"watch": "vite build --watch",
|
|
43
43
|
"clean": "git clean -fdX",
|
|
44
|
-
"pub": "node ../../scripts/publish-package.
|
|
44
|
+
"pub": "node ../../scripts/publish-package.mjs"
|
|
45
45
|
}
|
|
46
46
|
}
|