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