@sv-print/plugin-i18n 0.1.0 → 0.1.1
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/dist/index.js +1 -1
- package/dist/index.mjs +360 -356
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12,59 +12,59 @@ var re = (o, e, t) => e in o ? Ce(o, e, { enumerable: !0, configurable: !0, writ
|
|
|
12
12
|
}, O = (o, e) => ve(o, $e(e));
|
|
13
13
|
const g = (o) => typeof o == "string", U = () => {
|
|
14
14
|
let o, e;
|
|
15
|
-
const t = new Promise((
|
|
16
|
-
o =
|
|
15
|
+
const t = new Promise((i, s) => {
|
|
16
|
+
o = i, e = s;
|
|
17
17
|
});
|
|
18
18
|
return t.resolve = o, t.reject = e, t;
|
|
19
19
|
}, ae = (o) => o == null ? "" : "" + o, ke = (o, e, t) => {
|
|
20
|
-
o.forEach((
|
|
21
|
-
e[
|
|
20
|
+
o.forEach((i) => {
|
|
21
|
+
e[i] && (t[i] = e[i]);
|
|
22
22
|
});
|
|
23
23
|
}, Ne = /###/g, oe = (o) => o && o.indexOf("###") > -1 ? o.replace(Ne, ".") : o, le = (o) => !o || g(o), M = (o, e, t) => {
|
|
24
|
-
const
|
|
25
|
-
let
|
|
26
|
-
for (;
|
|
24
|
+
const i = g(e) ? e.split(".") : e;
|
|
25
|
+
let s = 0;
|
|
26
|
+
for (; s < i.length - 1; ) {
|
|
27
27
|
if (le(o))
|
|
28
28
|
return {};
|
|
29
|
-
const n = oe(s
|
|
30
|
-
!o[n] && t && (o[n] = new t()), Object.prototype.hasOwnProperty.call(o, n) ? o = o[n] : o = {}, ++
|
|
29
|
+
const n = oe(i[s]);
|
|
30
|
+
!o[n] && t && (o[n] = new t()), Object.prototype.hasOwnProperty.call(o, n) ? o = o[n] : o = {}, ++s;
|
|
31
31
|
}
|
|
32
32
|
return le(o) ? {} : {
|
|
33
33
|
obj: o,
|
|
34
|
-
k: oe(s
|
|
34
|
+
k: oe(i[s])
|
|
35
35
|
};
|
|
36
36
|
}, ue = (o, e, t) => {
|
|
37
37
|
const {
|
|
38
|
-
obj:
|
|
39
|
-
k:
|
|
38
|
+
obj: i,
|
|
39
|
+
k: s
|
|
40
40
|
} = M(o, e, Object);
|
|
41
|
-
if (
|
|
42
|
-
s
|
|
41
|
+
if (i !== void 0 || e.length === 1) {
|
|
42
|
+
i[s] = t;
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
let n = e[e.length - 1], r = e.slice(0, e.length - 1), a = M(o, r, Object);
|
|
46
46
|
for (; a.obj === void 0 && r.length; )
|
|
47
47
|
n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1), a = M(o, r, Object), (a == null ? void 0 : a.obj) && typeof a.obj[`${a.k}.${n}`] != "undefined" && (a.obj = void 0);
|
|
48
48
|
a.obj[`${a.k}.${n}`] = t;
|
|
49
|
-
}, Ee = (o, e, t,
|
|
49
|
+
}, Ee = (o, e, t, i) => {
|
|
50
50
|
const {
|
|
51
|
-
obj:
|
|
51
|
+
obj: s,
|
|
52
52
|
k: n
|
|
53
53
|
} = M(o, e, Object);
|
|
54
|
-
|
|
55
|
-
},
|
|
54
|
+
s[n] = s[n] || [], s[n].push(t);
|
|
55
|
+
}, Y = (o, e) => {
|
|
56
56
|
const {
|
|
57
57
|
obj: t,
|
|
58
|
-
k:
|
|
58
|
+
k: i
|
|
59
59
|
} = M(o, e);
|
|
60
|
-
if (!!t && !!Object.prototype.hasOwnProperty.call(t,
|
|
61
|
-
return t[
|
|
60
|
+
if (!!t && !!Object.prototype.hasOwnProperty.call(t, i))
|
|
61
|
+
return t[i];
|
|
62
62
|
}, Fe = (o, e, t) => {
|
|
63
|
-
const
|
|
64
|
-
return
|
|
63
|
+
const i = Y(o, t);
|
|
64
|
+
return i !== void 0 ? i : Y(e, t);
|
|
65
65
|
}, be = (o, e, t) => {
|
|
66
|
-
for (const
|
|
67
|
-
|
|
66
|
+
for (const i in e)
|
|
67
|
+
i !== "__proto__" && i !== "constructor" && (i in o ? g(o[i]) || o[i] instanceof String || g(e[i]) || e[i] instanceof String ? t && (o[i] = e[i]) : be(o[i], e[i], t) : o[i] = e[i]);
|
|
68
68
|
return o;
|
|
69
69
|
}, I = (o) => o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
70
70
|
var Te = {
|
|
@@ -84,20 +84,20 @@ class De {
|
|
|
84
84
|
const t = this.regExpMap.get(e);
|
|
85
85
|
if (t !== void 0)
|
|
86
86
|
return t;
|
|
87
|
-
const
|
|
88
|
-
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e,
|
|
87
|
+
const i = new RegExp(e);
|
|
88
|
+
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, i), this.regExpQueue.push(e), i;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
const Ie = [" ", ",", "?", "!", ";"], Ae = new De(20), Ve = (o, e, t) => {
|
|
92
92
|
e = e || "", t = t || "";
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
93
|
+
const i = Ie.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
|
|
94
|
+
if (i.length === 0)
|
|
95
95
|
return !0;
|
|
96
|
-
const
|
|
97
|
-
let n = !
|
|
96
|
+
const s = Ae.getRegExp(`(${i.map((r) => r === "?" ? "\\?" : r).join("|")})`);
|
|
97
|
+
let n = !s.test(o);
|
|
98
98
|
if (!n) {
|
|
99
99
|
const r = o.indexOf(t);
|
|
100
|
-
r > 0 && !
|
|
100
|
+
r > 0 && !s.test(o.substring(0, r)) && (n = !0);
|
|
101
101
|
}
|
|
102
102
|
return n;
|
|
103
103
|
}, q = (o, e, t = ".") => {
|
|
@@ -105,22 +105,22 @@ const Ie = [" ", ",", "?", "!", ";"], Ae = new De(20), Ve = (o, e, t) => {
|
|
|
105
105
|
return;
|
|
106
106
|
if (o[e])
|
|
107
107
|
return Object.prototype.hasOwnProperty.call(o, e) ? o[e] : void 0;
|
|
108
|
-
const
|
|
109
|
-
let
|
|
110
|
-
for (let n = 0; n <
|
|
111
|
-
if (!
|
|
108
|
+
const i = e.split(t);
|
|
109
|
+
let s = o;
|
|
110
|
+
for (let n = 0; n < i.length; ) {
|
|
111
|
+
if (!s || typeof s != "object")
|
|
112
112
|
return;
|
|
113
113
|
let r, a = "";
|
|
114
|
-
for (let l = n; l <
|
|
115
|
-
if (l !== n && (a += t), a +=
|
|
116
|
-
if (["string", "number", "boolean"].indexOf(typeof r) > -1 && l <
|
|
114
|
+
for (let l = n; l < i.length; ++l)
|
|
115
|
+
if (l !== n && (a += t), a += i[l], r = s[a], r !== void 0) {
|
|
116
|
+
if (["string", "number", "boolean"].indexOf(typeof r) > -1 && l < i.length - 1)
|
|
117
117
|
continue;
|
|
118
118
|
n += l - n + 1;
|
|
119
119
|
break;
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
s = r;
|
|
122
122
|
}
|
|
123
|
-
return
|
|
123
|
+
return s;
|
|
124
124
|
}, B = (o) => o == null ? void 0 : o.replace("_", "-"), Ke = {
|
|
125
125
|
type: "logger",
|
|
126
126
|
log(o) {
|
|
@@ -133,11 +133,11 @@ const Ie = [" ", ",", "?", "!", ";"], Ae = new De(20), Ve = (o, e, t) => {
|
|
|
133
133
|
this.output("error", o);
|
|
134
134
|
},
|
|
135
135
|
output(o, e) {
|
|
136
|
-
var t,
|
|
137
|
-
(
|
|
136
|
+
var t, i;
|
|
137
|
+
(i = (t = console == null ? void 0 : console[o]) == null ? void 0 : t.apply) == null || i.call(t, console, e);
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
-
class
|
|
140
|
+
class Q {
|
|
141
141
|
constructor(e, t = {}) {
|
|
142
142
|
this.init(e, t);
|
|
143
143
|
}
|
|
@@ -156,28 +156,28 @@ class Y {
|
|
|
156
156
|
deprecate(...e) {
|
|
157
157
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
158
158
|
}
|
|
159
|
-
forward(e, t,
|
|
160
|
-
return
|
|
159
|
+
forward(e, t, i, s) {
|
|
160
|
+
return s && !this.debug ? null : (g(e[0]) && (e[0] = `${i}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
161
161
|
}
|
|
162
162
|
create(e) {
|
|
163
|
-
return new
|
|
163
|
+
return new Q(this.logger, p({
|
|
164
164
|
prefix: `${this.prefix}:${e}:`
|
|
165
165
|
}, this.options));
|
|
166
166
|
}
|
|
167
167
|
clone(e) {
|
|
168
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new
|
|
168
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new Q(this.logger, e);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
var N = new
|
|
172
|
-
class
|
|
171
|
+
var N = new Q();
|
|
172
|
+
class Z {
|
|
173
173
|
constructor() {
|
|
174
174
|
this.observers = {};
|
|
175
175
|
}
|
|
176
176
|
on(e, t) {
|
|
177
|
-
return e.split(" ").forEach((
|
|
178
|
-
this.observers[
|
|
179
|
-
const
|
|
180
|
-
this.observers[
|
|
177
|
+
return e.split(" ").forEach((i) => {
|
|
178
|
+
this.observers[i] || (this.observers[i] = /* @__PURE__ */ new Map());
|
|
179
|
+
const s = this.observers[i].get(t) || 0;
|
|
180
|
+
this.observers[i].set(t, s + 1);
|
|
181
181
|
}), this;
|
|
182
182
|
}
|
|
183
183
|
off(e, t) {
|
|
@@ -190,16 +190,16 @@ class G {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
emit(e, ...t) {
|
|
193
|
-
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([
|
|
193
|
+
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([s, n]) => {
|
|
194
194
|
for (let r = 0; r < n; r++)
|
|
195
|
-
|
|
196
|
-
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([
|
|
195
|
+
s(...t);
|
|
196
|
+
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([s, n]) => {
|
|
197
197
|
for (let r = 0; r < n; r++)
|
|
198
|
-
|
|
198
|
+
s.apply(s, [e, ...t]);
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
class fe extends
|
|
202
|
+
class fe extends Z {
|
|
203
203
|
constructor(e, t = {
|
|
204
204
|
ns: ["translation"],
|
|
205
205
|
defaultNS: "translation"
|
|
@@ -213,38 +213,38 @@ class fe extends G {
|
|
|
213
213
|
const t = this.options.ns.indexOf(e);
|
|
214
214
|
t > -1 && this.options.ns.splice(t, 1);
|
|
215
215
|
}
|
|
216
|
-
getResource(e, t,
|
|
216
|
+
getResource(e, t, i, s = {}) {
|
|
217
217
|
var u, h;
|
|
218
|
-
const n =
|
|
218
|
+
const n = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, r = s.ignoreJSONStructure !== void 0 ? s.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
219
219
|
let a;
|
|
220
|
-
e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t],
|
|
221
|
-
const l =
|
|
222
|
-
return !l && !t && !
|
|
220
|
+
e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], i && (Array.isArray(i) ? a.push(...i) : g(i) && n ? a.push(...i.split(n)) : a.push(i)));
|
|
221
|
+
const l = Y(this.data, a);
|
|
222
|
+
return !l && !t && !i && e.indexOf(".") > -1 && (e = a[0], t = a[1], i = a.slice(2).join(".")), l || !r || !g(i) ? l : q((h = (u = this.data) == null ? void 0 : u[e]) == null ? void 0 : h[t], i, n);
|
|
223
223
|
}
|
|
224
|
-
addResource(e, t,
|
|
224
|
+
addResource(e, t, i, s, n = {
|
|
225
225
|
silent: !1
|
|
226
226
|
}) {
|
|
227
227
|
const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
|
|
228
228
|
let a = [e, t];
|
|
229
|
-
|
|
229
|
+
i && (a = a.concat(r ? i.split(r) : i)), e.indexOf(".") > -1 && (a = e.split("."), s = t, t = a[1]), this.addNamespaces(t), ue(this.data, a, s), n.silent || this.emit("added", e, t, i, s);
|
|
230
230
|
}
|
|
231
|
-
addResources(e, t,
|
|
231
|
+
addResources(e, t, i, s = {
|
|
232
232
|
silent: !1
|
|
233
233
|
}) {
|
|
234
|
-
for (const n in
|
|
235
|
-
(g(
|
|
234
|
+
for (const n in i)
|
|
235
|
+
(g(i[n]) || Array.isArray(i[n])) && this.addResource(e, t, n, i[n], {
|
|
236
236
|
silent: !0
|
|
237
237
|
});
|
|
238
|
-
|
|
238
|
+
s.silent || this.emit("added", e, t, i);
|
|
239
239
|
}
|
|
240
|
-
addResourceBundle(e, t,
|
|
240
|
+
addResourceBundle(e, t, i, s, n, r = {
|
|
241
241
|
silent: !1,
|
|
242
242
|
skipCopy: !1
|
|
243
243
|
}) {
|
|
244
244
|
let a = [e, t];
|
|
245
|
-
e.indexOf(".") > -1 && (a = e.split("."),
|
|
246
|
-
let l =
|
|
247
|
-
r.skipCopy || (
|
|
245
|
+
e.indexOf(".") > -1 && (a = e.split("."), s = i, i = t, t = a[1]), this.addNamespaces(t);
|
|
246
|
+
let l = Y(this.data, a) || {};
|
|
247
|
+
r.skipCopy || (i = JSON.parse(JSON.stringify(i))), s ? be(l, i, n) : l = p(p({}, l), i), ue(this.data, a, l), r.silent || this.emit("added", e, t, i);
|
|
248
248
|
}
|
|
249
249
|
removeResourceBundle(e, t) {
|
|
250
250
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -260,7 +260,7 @@ class fe extends G {
|
|
|
260
260
|
}
|
|
261
261
|
hasLanguageSomeTranslations(e) {
|
|
262
262
|
const t = this.getDataByLanguage(e);
|
|
263
|
-
return !!(t && Object.keys(t) || []).find((
|
|
263
|
+
return !!(t && Object.keys(t) || []).find((s) => t[s] && Object.keys(t[s]).length > 0);
|
|
264
264
|
}
|
|
265
265
|
toJSON() {
|
|
266
266
|
return this.data;
|
|
@@ -271,15 +271,15 @@ var Le = {
|
|
|
271
271
|
addPostProcessor(o) {
|
|
272
272
|
this.processors[o.name] = o;
|
|
273
273
|
},
|
|
274
|
-
handle(o, e, t,
|
|
274
|
+
handle(o, e, t, i, s) {
|
|
275
275
|
return o.forEach((n) => {
|
|
276
276
|
var r, a;
|
|
277
|
-
e = (a = (r = this.processors[n]) == null ? void 0 : r.process(e, t,
|
|
277
|
+
e = (a = (r = this.processors[n]) == null ? void 0 : r.process(e, t, i, s)) != null ? a : e;
|
|
278
278
|
}), e;
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
281
|
const he = {}, ce = (o) => !g(o) && typeof o != "boolean" && typeof o != "number";
|
|
282
|
-
class
|
|
282
|
+
class G extends Z {
|
|
283
283
|
constructor(e, t = {}) {
|
|
284
284
|
super(), ke(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = N.create("translator");
|
|
285
285
|
}
|
|
@@ -289,18 +289,18 @@ class Q extends G {
|
|
|
289
289
|
exists(e, t = {
|
|
290
290
|
interpolation: {}
|
|
291
291
|
}) {
|
|
292
|
-
const
|
|
292
|
+
const i = p({}, t);
|
|
293
293
|
if (e == null)
|
|
294
294
|
return !1;
|
|
295
|
-
const
|
|
296
|
-
return (
|
|
295
|
+
const s = this.resolve(e, i);
|
|
296
|
+
return (s == null ? void 0 : s.res) !== void 0;
|
|
297
297
|
}
|
|
298
298
|
extractFromKey(e, t) {
|
|
299
|
-
let
|
|
300
|
-
|
|
301
|
-
const
|
|
299
|
+
let i = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
|
|
300
|
+
i === void 0 && (i = ":");
|
|
301
|
+
const s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
302
302
|
let n = t.ns || this.options.defaultNS || [];
|
|
303
|
-
const r =
|
|
303
|
+
const r = i && e.indexOf(i) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Ve(e, i, s);
|
|
304
304
|
if (r && !a) {
|
|
305
305
|
const l = e.match(this.interpolator.nestingRegexp);
|
|
306
306
|
if (l && l.length > 0)
|
|
@@ -308,26 +308,26 @@ class Q extends G {
|
|
|
308
308
|
key: e,
|
|
309
309
|
namespaces: g(n) ? [n] : n
|
|
310
310
|
};
|
|
311
|
-
const u = e.split(
|
|
312
|
-
(
|
|
311
|
+
const u = e.split(i);
|
|
312
|
+
(i !== s || i === s && this.options.ns.indexOf(u[0]) > -1) && (n = u.shift()), e = u.join(s);
|
|
313
313
|
}
|
|
314
314
|
return {
|
|
315
315
|
key: e,
|
|
316
316
|
namespaces: g(n) ? [n] : n
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
translate(e, t,
|
|
320
|
-
let
|
|
321
|
-
if (typeof
|
|
319
|
+
translate(e, t, i) {
|
|
320
|
+
let s = typeof t == "object" ? p({}, t) : t;
|
|
321
|
+
if (typeof s != "object" && this.options.overloadTranslationOptionHandler && (s = this.options.overloadTranslationOptionHandler(arguments)), typeof options == "object" && (s = p({}, s)), s || (s = {}), e == null)
|
|
322
322
|
return "";
|
|
323
323
|
Array.isArray(e) || (e = [String(e)]);
|
|
324
|
-
const n =
|
|
324
|
+
const n = s.returnDetails !== void 0 ? s.returnDetails : this.options.returnDetails, r = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, {
|
|
325
325
|
key: a,
|
|
326
326
|
namespaces: l
|
|
327
|
-
} = this.extractFromKey(e[e.length - 1],
|
|
328
|
-
let h =
|
|
327
|
+
} = this.extractFromKey(e[e.length - 1], s), u = l[l.length - 1];
|
|
328
|
+
let h = s.nsSeparator !== void 0 ? s.nsSeparator : this.options.nsSeparator;
|
|
329
329
|
h === void 0 && (h = ":");
|
|
330
|
-
const f =
|
|
330
|
+
const f = s.lng || this.language, m = s.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
331
331
|
if ((f == null ? void 0 : f.toLowerCase()) === "cimode")
|
|
332
332
|
return m ? n ? {
|
|
333
333
|
res: `${u}${h}${a}`,
|
|
@@ -335,41 +335,41 @@ class Q extends G {
|
|
|
335
335
|
exactUsedKey: a,
|
|
336
336
|
usedLng: f,
|
|
337
337
|
usedNS: u,
|
|
338
|
-
usedParams: this.getUsedParamsDetails(
|
|
338
|
+
usedParams: this.getUsedParamsDetails(s)
|
|
339
339
|
} : `${u}${h}${a}` : n ? {
|
|
340
340
|
res: a,
|
|
341
341
|
usedKey: a,
|
|
342
342
|
exactUsedKey: a,
|
|
343
343
|
usedLng: f,
|
|
344
344
|
usedNS: u,
|
|
345
|
-
usedParams: this.getUsedParamsDetails(
|
|
345
|
+
usedParams: this.getUsedParamsDetails(s)
|
|
346
346
|
} : a;
|
|
347
|
-
const d = this.resolve(e,
|
|
347
|
+
const d = this.resolve(e, s);
|
|
348
348
|
let c = d == null ? void 0 : d.res;
|
|
349
|
-
const x = (d == null ? void 0 : d.usedKey) || a, S = (d == null ? void 0 : d.exactUsedKey) || a, $ = ["[object Number]", "[object Function]", "[object RegExp]"], v =
|
|
349
|
+
const x = (d == null ? void 0 : d.usedKey) || a, S = (d == null ? void 0 : d.exactUsedKey) || a, $ = ["[object Number]", "[object Function]", "[object RegExp]"], v = s.joinArrays !== void 0 ? s.joinArrays : this.options.joinArrays, j = !this.i18nFormat || this.i18nFormat.handleAsObject, L = s.count !== void 0 && !g(s.count), E = G.hasDefaultValue(s), z = L ? this.pluralResolver.getSuffix(f, s.count, s) : "", F = s.ordinal && L ? this.pluralResolver.getSuffix(f, s.count, {
|
|
350
350
|
ordinal: !1
|
|
351
|
-
}) : "", A = L && !
|
|
351
|
+
}) : "", A = L && !s.ordinal && s.count === 0, w = A && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${z}`] || s[`defaultValue${F}`] || s.defaultValue;
|
|
352
352
|
let b = c;
|
|
353
353
|
j && !c && E && (b = w);
|
|
354
354
|
const Oe = ce(b), we = Object.prototype.toString.apply(b);
|
|
355
355
|
if (j && b && Oe && $.indexOf(we) < 0 && !(g(v) && Array.isArray(b))) {
|
|
356
|
-
if (!
|
|
356
|
+
if (!s.returnObjects && !this.options.returnObjects) {
|
|
357
357
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
358
|
-
const P = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(x, b, O(p({},
|
|
358
|
+
const P = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(x, b, O(p({}, s), {
|
|
359
359
|
ns: l
|
|
360
360
|
})) : `key '${a} (${this.language})' returned an object instead of string.`;
|
|
361
|
-
return n ? (d.res = P, d.usedParams = this.getUsedParamsDetails(
|
|
361
|
+
return n ? (d.res = P, d.usedParams = this.getUsedParamsDetails(s), d) : P;
|
|
362
362
|
}
|
|
363
363
|
if (r) {
|
|
364
364
|
const P = Array.isArray(b), R = P ? [] : {}, ee = P ? S : x;
|
|
365
365
|
for (const k in b)
|
|
366
366
|
if (Object.prototype.hasOwnProperty.call(b, k)) {
|
|
367
367
|
const T = `${ee}${r}${k}`;
|
|
368
|
-
E && !c ? R[k] = this.translate(T, O(p({},
|
|
368
|
+
E && !c ? R[k] = this.translate(T, O(p({}, s), {
|
|
369
369
|
defaultValue: ce(w) ? w[k] : void 0,
|
|
370
370
|
joinArrays: !1,
|
|
371
371
|
ns: l
|
|
372
|
-
})) : R[k] = this.translate(T, O(p({},
|
|
372
|
+
})) : R[k] = this.translate(T, O(p({}, s), {
|
|
373
373
|
joinArrays: !1,
|
|
374
374
|
ns: l
|
|
375
375
|
})), R[k] === T && (R[k] = b[k]);
|
|
@@ -377,86 +377,86 @@ class Q extends G {
|
|
|
377
377
|
c = R;
|
|
378
378
|
}
|
|
379
379
|
} else if (j && g(v) && Array.isArray(c))
|
|
380
|
-
c = c.join(v), c && (c = this.extendTranslation(c, e,
|
|
380
|
+
c = c.join(v), c && (c = this.extendTranslation(c, e, s, i));
|
|
381
381
|
else {
|
|
382
382
|
let P = !1, R = !1;
|
|
383
383
|
!this.isValidLookup(c) && E && (P = !0, c = w), this.isValidLookup(c) || (R = !0, c = a);
|
|
384
|
-
const k = (
|
|
384
|
+
const k = (s.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && R ? void 0 : c, T = E && w !== c && this.options.updateMissing;
|
|
385
385
|
if (R || P || T) {
|
|
386
386
|
if (this.logger.log(T ? "updateKey" : "missingKey", f, u, a, T ? w : c), r) {
|
|
387
|
-
const C = this.resolve(a, O(p({},
|
|
387
|
+
const C = this.resolve(a, O(p({}, s), {
|
|
388
388
|
keySeparator: !1
|
|
389
389
|
}));
|
|
390
390
|
C && C.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
391
391
|
}
|
|
392
392
|
let V = [];
|
|
393
|
-
const J = this.languageUtils.getFallbackCodes(this.options.fallbackLng,
|
|
393
|
+
const J = this.languageUtils.getFallbackCodes(this.options.fallbackLng, s.lng || this.language);
|
|
394
394
|
if (this.options.saveMissingTo === "fallback" && J && J[0])
|
|
395
395
|
for (let C = 0; C < J.length; C++)
|
|
396
396
|
V.push(J[C]);
|
|
397
397
|
else
|
|
398
|
-
this.options.saveMissingTo === "all" ? V = this.languageUtils.toResolveHierarchy(
|
|
398
|
+
this.options.saveMissingTo === "all" ? V = this.languageUtils.toResolveHierarchy(s.lng || this.language) : V.push(s.lng || this.language);
|
|
399
399
|
const te = (C, D, K) => {
|
|
400
|
-
var
|
|
401
|
-
const
|
|
402
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(C, u, D,
|
|
400
|
+
var se;
|
|
401
|
+
const ie = E && K !== c ? K : k;
|
|
402
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(C, u, D, ie, T, s) : (se = this.backendConnector) != null && se.saveMissing && this.backendConnector.saveMissing(C, u, D, ie, T, s), this.emit("missingKey", C, u, D, c);
|
|
403
403
|
};
|
|
404
404
|
this.options.saveMissing && (this.options.saveMissingPlurals && L ? V.forEach((C) => {
|
|
405
|
-
const D = this.pluralResolver.getSuffixes(C,
|
|
406
|
-
A &&
|
|
407
|
-
te([C], a + K,
|
|
405
|
+
const D = this.pluralResolver.getSuffixes(C, s);
|
|
406
|
+
A && s[`defaultValue${this.options.pluralSeparator}zero`] && D.indexOf(`${this.options.pluralSeparator}zero`) < 0 && D.push(`${this.options.pluralSeparator}zero`), D.forEach((K) => {
|
|
407
|
+
te([C], a + K, s[`defaultValue${K}`] || w);
|
|
408
408
|
});
|
|
409
409
|
}) : te(V, a, w));
|
|
410
410
|
}
|
|
411
|
-
c = this.extendTranslation(c, e,
|
|
411
|
+
c = this.extendTranslation(c, e, s, d, i), R && c === a && this.options.appendNamespaceToMissingKey && (c = `${u}${h}${a}`), (R || P) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${h}${a}` : a, P ? c : void 0, s));
|
|
412
412
|
}
|
|
413
|
-
return n ? (d.res = c, d.usedParams = this.getUsedParamsDetails(
|
|
413
|
+
return n ? (d.res = c, d.usedParams = this.getUsedParamsDetails(s), d) : c;
|
|
414
414
|
}
|
|
415
|
-
extendTranslation(e, t,
|
|
415
|
+
extendTranslation(e, t, i, s, n) {
|
|
416
416
|
var l, u;
|
|
417
417
|
if ((l = this.i18nFormat) != null && l.parse)
|
|
418
|
-
e = this.i18nFormat.parse(e, p(p({}, this.options.interpolation.defaultVariables),
|
|
419
|
-
resolved:
|
|
418
|
+
e = this.i18nFormat.parse(e, p(p({}, this.options.interpolation.defaultVariables), i), i.lng || this.language || s.usedLng, s.usedNS, s.usedKey, {
|
|
419
|
+
resolved: s
|
|
420
420
|
});
|
|
421
|
-
else if (!
|
|
422
|
-
|
|
423
|
-
interpolation: p(p({}, this.options.interpolation),
|
|
421
|
+
else if (!i.skipInterpolation) {
|
|
422
|
+
i.interpolation && this.interpolator.init(O(p({}, i), {
|
|
423
|
+
interpolation: p(p({}, this.options.interpolation), i.interpolation)
|
|
424
424
|
}));
|
|
425
|
-
const h = g(e) && (((u =
|
|
425
|
+
const h = g(e) && (((u = i == null ? void 0 : i.interpolation) == null ? void 0 : u.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
426
426
|
let f;
|
|
427
427
|
if (h) {
|
|
428
428
|
const d = e.match(this.interpolator.nestingRegexp);
|
|
429
429
|
f = d && d.length;
|
|
430
430
|
}
|
|
431
|
-
let m =
|
|
432
|
-
if (this.options.interpolation.defaultVariables && (m = p(p({}, this.options.interpolation.defaultVariables), m)), e = this.interpolator.interpolate(e, m,
|
|
431
|
+
let m = i.replace && !g(i.replace) ? i.replace : i;
|
|
432
|
+
if (this.options.interpolation.defaultVariables && (m = p(p({}, this.options.interpolation.defaultVariables), m)), e = this.interpolator.interpolate(e, m, i.lng || this.language || s.usedLng, i), h) {
|
|
433
433
|
const d = e.match(this.interpolator.nestingRegexp), c = d && d.length;
|
|
434
|
-
f < c && (
|
|
434
|
+
f < c && (i.nest = !1);
|
|
435
435
|
}
|
|
436
|
-
!
|
|
436
|
+
!i.lng && s && s.res && (i.lng = this.language || s.usedLng), i.nest !== !1 && (e = this.interpolator.nest(e, (...d) => (n == null ? void 0 : n[0]) === d[0] && !i.context ? (this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${t[0]}`), null) : this.translate(...d, t), i)), i.interpolation && this.interpolator.reset();
|
|
437
437
|
}
|
|
438
|
-
const r =
|
|
439
|
-
return e != null && (a == null ? void 0 : a.length) &&
|
|
440
|
-
i18nResolved: O(p({},
|
|
441
|
-
usedParams: this.getUsedParamsDetails(
|
|
438
|
+
const r = i.postProcess || this.options.postProcess, a = g(r) ? [r] : r;
|
|
439
|
+
return e != null && (a == null ? void 0 : a.length) && i.applyPostProcessor !== !1 && (e = Le.handle(a, e, t, this.options && this.options.postProcessPassResolved ? p({
|
|
440
|
+
i18nResolved: O(p({}, s), {
|
|
441
|
+
usedParams: this.getUsedParamsDetails(i)
|
|
442
442
|
})
|
|
443
|
-
},
|
|
443
|
+
}, i) : i, this)), e;
|
|
444
444
|
}
|
|
445
445
|
resolve(e, t = {}) {
|
|
446
|
-
let
|
|
446
|
+
let i, s, n, r, a;
|
|
447
447
|
return g(e) && (e = [e]), e.forEach((l) => {
|
|
448
|
-
if (this.isValidLookup(
|
|
448
|
+
if (this.isValidLookup(i))
|
|
449
449
|
return;
|
|
450
450
|
const u = this.extractFromKey(l, t), h = u.key;
|
|
451
|
-
|
|
451
|
+
s = h;
|
|
452
452
|
let f = u.namespaces;
|
|
453
453
|
this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
|
|
454
454
|
const m = t.count !== void 0 && !g(t.count), d = m && !t.ordinal && t.count === 0, c = t.context !== void 0 && (g(t.context) || typeof t.context == "number") && t.context !== "", x = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
455
455
|
f.forEach((S) => {
|
|
456
456
|
var $, v;
|
|
457
|
-
this.isValidLookup(
|
|
457
|
+
this.isValidLookup(i) || (a = S, !he[`${x[0]}-${S}`] && (($ = this.utils) == null ? void 0 : $.hasLoadedNamespace) && !((v = this.utils) != null && v.hasLoadedNamespace(a)) && (he[`${x[0]}-${S}`] = !0, this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), x.forEach((j) => {
|
|
458
458
|
var z;
|
|
459
|
-
if (this.isValidLookup(
|
|
459
|
+
if (this.isValidLookup(i))
|
|
460
460
|
return;
|
|
461
461
|
r = j;
|
|
462
462
|
const L = [h];
|
|
@@ -473,12 +473,12 @@ class Q extends G {
|
|
|
473
473
|
}
|
|
474
474
|
let E;
|
|
475
475
|
for (; E = L.pop(); )
|
|
476
|
-
this.isValidLookup(
|
|
476
|
+
this.isValidLookup(i) || (n = E, i = this.getResource(j, S, E, t));
|
|
477
477
|
}));
|
|
478
478
|
});
|
|
479
479
|
}), {
|
|
480
|
-
res:
|
|
481
|
-
usedKey:
|
|
480
|
+
res: i,
|
|
481
|
+
usedKey: s,
|
|
482
482
|
exactUsedKey: n,
|
|
483
483
|
usedLng: r,
|
|
484
484
|
usedNS: a
|
|
@@ -487,24 +487,24 @@ class Q extends G {
|
|
|
487
487
|
isValidLookup(e) {
|
|
488
488
|
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
489
489
|
}
|
|
490
|
-
getResource(e, t,
|
|
490
|
+
getResource(e, t, i, s = {}) {
|
|
491
491
|
var n;
|
|
492
|
-
return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t,
|
|
492
|
+
return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t, i, s) : this.resourceStore.getResource(e, t, i, s);
|
|
493
493
|
}
|
|
494
494
|
getUsedParamsDetails(e = {}) {
|
|
495
|
-
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"],
|
|
496
|
-
let
|
|
497
|
-
if (
|
|
498
|
-
|
|
495
|
+
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], i = e.replace && !g(e.replace);
|
|
496
|
+
let s = i ? e.replace : e;
|
|
497
|
+
if (i && typeof e.count != "undefined" && (s.count = e.count), this.options.interpolation.defaultVariables && (s = p(p({}, this.options.interpolation.defaultVariables), s)), !i) {
|
|
498
|
+
s = p({}, s);
|
|
499
499
|
for (const n of t)
|
|
500
|
-
delete
|
|
500
|
+
delete s[n];
|
|
501
501
|
}
|
|
502
|
-
return
|
|
502
|
+
return s;
|
|
503
503
|
}
|
|
504
504
|
static hasDefaultValue(e) {
|
|
505
505
|
const t = "defaultValue";
|
|
506
|
-
for (const
|
|
507
|
-
if (Object.prototype.hasOwnProperty.call(e,
|
|
506
|
+
for (const i in e)
|
|
507
|
+
if (Object.prototype.hasOwnProperty.call(e, i) && t === i.substring(0, t.length) && e[i] !== void 0)
|
|
508
508
|
return !0;
|
|
509
509
|
return !1;
|
|
510
510
|
}
|
|
@@ -530,7 +530,7 @@ class de {
|
|
|
530
530
|
let t;
|
|
531
531
|
try {
|
|
532
532
|
t = Intl.getCanonicalLocales(e)[0];
|
|
533
|
-
} catch (
|
|
533
|
+
} catch (i) {
|
|
534
534
|
}
|
|
535
535
|
return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
|
|
536
536
|
}
|
|
@@ -543,18 +543,18 @@ class de {
|
|
|
543
543
|
if (!e)
|
|
544
544
|
return null;
|
|
545
545
|
let t;
|
|
546
|
-
return e.forEach((
|
|
546
|
+
return e.forEach((i) => {
|
|
547
547
|
if (t)
|
|
548
548
|
return;
|
|
549
|
-
const
|
|
550
|
-
(!this.options.supportedLngs || this.isSupportedCode(
|
|
551
|
-
}), !t && this.options.supportedLngs && e.forEach((
|
|
549
|
+
const s = this.formatLanguageCode(i);
|
|
550
|
+
(!this.options.supportedLngs || this.isSupportedCode(s)) && (t = s);
|
|
551
|
+
}), !t && this.options.supportedLngs && e.forEach((i) => {
|
|
552
552
|
if (t)
|
|
553
553
|
return;
|
|
554
|
-
const
|
|
555
|
-
if (this.isSupportedCode(
|
|
556
|
-
return t =
|
|
557
|
-
const n = this.getLanguagePartFromCode(
|
|
554
|
+
const s = this.getScriptPartFromCode(i);
|
|
555
|
+
if (this.isSupportedCode(s))
|
|
556
|
+
return t = s;
|
|
557
|
+
const n = this.getLanguagePartFromCode(i);
|
|
558
558
|
if (this.isSupportedCode(n))
|
|
559
559
|
return t = n;
|
|
560
560
|
t = this.options.supportedLngs.find((r) => {
|
|
@@ -572,16 +572,16 @@ class de {
|
|
|
572
572
|
return e;
|
|
573
573
|
if (!t)
|
|
574
574
|
return e.default || [];
|
|
575
|
-
let
|
|
576
|
-
return
|
|
575
|
+
let i = e[t];
|
|
576
|
+
return i || (i = e[this.getScriptPartFromCode(t)]), i || (i = e[this.formatLanguageCode(t)]), i || (i = e[this.getLanguagePartFromCode(t)]), i || (i = e.default), i || [];
|
|
577
577
|
}
|
|
578
578
|
toResolveHierarchy(e, t) {
|
|
579
|
-
const
|
|
580
|
-
!r || (this.isSupportedCode(r) ?
|
|
579
|
+
const i = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), s = [], n = (r) => {
|
|
580
|
+
!r || (this.isSupportedCode(r) ? s.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
|
|
581
581
|
};
|
|
582
|
-
return g(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && n(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && n(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && n(this.getLanguagePartFromCode(e))) : g(e) && n(this.formatLanguageCode(e)),
|
|
583
|
-
|
|
584
|
-
}),
|
|
582
|
+
return g(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && n(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && n(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && n(this.getLanguagePartFromCode(e))) : g(e) && n(this.formatLanguageCode(e)), i.forEach((r) => {
|
|
583
|
+
s.indexOf(r) < 0 && n(this.formatLanguageCode(r));
|
|
584
|
+
}), s;
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
const pe = {
|
|
@@ -608,16 +608,16 @@ class Ue {
|
|
|
608
608
|
this.pluralRulesCache = {};
|
|
609
609
|
}
|
|
610
610
|
getRule(e, t = {}) {
|
|
611
|
-
const
|
|
612
|
-
cleanedCode:
|
|
613
|
-
type:
|
|
611
|
+
const i = B(e === "dev" ? "en" : e), s = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
|
|
612
|
+
cleanedCode: i,
|
|
613
|
+
type: s
|
|
614
614
|
});
|
|
615
615
|
if (n in this.pluralRulesCache)
|
|
616
616
|
return this.pluralRulesCache[n];
|
|
617
617
|
let r;
|
|
618
618
|
try {
|
|
619
|
-
r = new Intl.PluralRules(
|
|
620
|
-
type:
|
|
619
|
+
r = new Intl.PluralRules(i, {
|
|
620
|
+
type: s
|
|
621
621
|
});
|
|
622
622
|
} catch (a) {
|
|
623
623
|
if (!Intl)
|
|
@@ -630,29 +630,29 @@ class Ue {
|
|
|
630
630
|
return this.pluralRulesCache[n] = r, r;
|
|
631
631
|
}
|
|
632
632
|
needsPlural(e, t = {}) {
|
|
633
|
-
let
|
|
634
|
-
return
|
|
633
|
+
let i = this.getRule(e, t);
|
|
634
|
+
return i || (i = this.getRule("dev", t)), (i == null ? void 0 : i.resolvedOptions().pluralCategories.length) > 1;
|
|
635
635
|
}
|
|
636
|
-
getPluralFormsOfKey(e, t,
|
|
637
|
-
return this.getSuffixes(e,
|
|
636
|
+
getPluralFormsOfKey(e, t, i = {}) {
|
|
637
|
+
return this.getSuffixes(e, i).map((s) => `${t}${s}`);
|
|
638
638
|
}
|
|
639
639
|
getSuffixes(e, t = {}) {
|
|
640
|
-
let
|
|
641
|
-
return
|
|
640
|
+
let i = this.getRule(e, t);
|
|
641
|
+
return i || (i = this.getRule("dev", t)), i ? i.resolvedOptions().pluralCategories.sort((s, n) => pe[s] - pe[n]).map((s) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${s}`) : [];
|
|
642
642
|
}
|
|
643
|
-
getSuffix(e, t,
|
|
644
|
-
const
|
|
645
|
-
return
|
|
643
|
+
getSuffix(e, t, i = {}) {
|
|
644
|
+
const s = this.getRule(e, i);
|
|
645
|
+
return s ? `${this.options.prepend}${i.ordinal ? `ordinal${this.options.prepend}` : ""}${s.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, i));
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
|
-
const me = (o, e, t,
|
|
648
|
+
const me = (o, e, t, i = ".", s = !0) => {
|
|
649
649
|
let n = Fe(o, e, t);
|
|
650
|
-
return !n &&
|
|
651
|
-
},
|
|
650
|
+
return !n && s && g(t) && (n = q(o, t, i), n === void 0 && (n = q(e, t, i))), n;
|
|
651
|
+
}, X = (o) => o.replace(/\$/g, "$$$$");
|
|
652
652
|
class Me {
|
|
653
653
|
constructor(e = {}) {
|
|
654
654
|
var t;
|
|
655
|
-
this.logger = N.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((
|
|
655
|
+
this.logger = N.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((i) => i), this.init(e);
|
|
656
656
|
}
|
|
657
657
|
init(e = {}) {
|
|
658
658
|
e.interpolation || (e.interpolation = {
|
|
@@ -660,8 +660,8 @@ class Me {
|
|
|
660
660
|
});
|
|
661
661
|
const {
|
|
662
662
|
escape: t,
|
|
663
|
-
escapeValue:
|
|
664
|
-
useRawValueToEscape:
|
|
663
|
+
escapeValue: i,
|
|
664
|
+
useRawValueToEscape: s,
|
|
665
665
|
prefix: n,
|
|
666
666
|
prefixEscaped: r,
|
|
667
667
|
suffix: a,
|
|
@@ -677,46 +677,46 @@ class Me {
|
|
|
677
677
|
maxReplaces: $,
|
|
678
678
|
alwaysFormat: v
|
|
679
679
|
} = e.interpolation;
|
|
680
|
-
this.escape = t !== void 0 ? t : je, this.escapeValue =
|
|
680
|
+
this.escape = t !== void 0 ? t : je, this.escapeValue = i !== void 0 ? i : !0, this.useRawValueToEscape = s !== void 0 ? s : !1, this.prefix = n ? I(n) : r || "{{", this.suffix = a ? I(a) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = h ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = m ? I(m) : d || I("$t("), this.nestingSuffix = c ? I(c) : x || I(")"), this.nestingOptionsSeparator = S || ",", this.maxReplaces = $ || 1e3, this.alwaysFormat = v !== void 0 ? v : !1, this.resetRegExp();
|
|
681
681
|
}
|
|
682
682
|
reset() {
|
|
683
683
|
this.options && this.init(this.options);
|
|
684
684
|
}
|
|
685
685
|
resetRegExp() {
|
|
686
|
-
const e = (t,
|
|
686
|
+
const e = (t, i) => (t == null ? void 0 : t.source) === i ? (t.lastIndex = 0, t) : new RegExp(i, "g");
|
|
687
687
|
this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
|
|
688
688
|
}
|
|
689
|
-
interpolate(e, t,
|
|
689
|
+
interpolate(e, t, i, s) {
|
|
690
690
|
var d;
|
|
691
691
|
let n, r, a;
|
|
692
692
|
const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (c) => {
|
|
693
693
|
if (c.indexOf(this.formatSeparator) < 0) {
|
|
694
694
|
const v = me(t, l, c, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
695
|
-
return this.alwaysFormat ? this.format(v, void 0,
|
|
695
|
+
return this.alwaysFormat ? this.format(v, void 0, i, O(p(p({}, s), t), {
|
|
696
696
|
interpolationkey: c
|
|
697
697
|
})) : v;
|
|
698
698
|
}
|
|
699
699
|
const x = c.split(this.formatSeparator), S = x.shift().trim(), $ = x.join(this.formatSeparator).trim();
|
|
700
|
-
return this.format(me(t, l, S, this.options.keySeparator, this.options.ignoreJSONStructure), $,
|
|
700
|
+
return this.format(me(t, l, S, this.options.keySeparator, this.options.ignoreJSONStructure), $, i, O(p(p({}, s), t), {
|
|
701
701
|
interpolationkey: S
|
|
702
702
|
}));
|
|
703
703
|
};
|
|
704
704
|
this.resetRegExp();
|
|
705
|
-
const h = (
|
|
705
|
+
const h = (s == null ? void 0 : s.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((d = s == null ? void 0 : s.interpolation) == null ? void 0 : d.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
706
706
|
return [{
|
|
707
707
|
regex: this.regexpUnescape,
|
|
708
|
-
safeValue: (c) =>
|
|
708
|
+
safeValue: (c) => X(c)
|
|
709
709
|
}, {
|
|
710
710
|
regex: this.regexp,
|
|
711
|
-
safeValue: (c) => this.escapeValue ?
|
|
711
|
+
safeValue: (c) => this.escapeValue ? X(this.escape(c)) : X(c)
|
|
712
712
|
}].forEach((c) => {
|
|
713
713
|
for (a = 0; n = c.regex.exec(e); ) {
|
|
714
714
|
const x = n[1].trim();
|
|
715
715
|
if (r = u(x), r === void 0)
|
|
716
716
|
if (typeof h == "function") {
|
|
717
|
-
const $ = h(e, n,
|
|
717
|
+
const $ = h(e, n, s);
|
|
718
718
|
r = g($) ? $ : "";
|
|
719
|
-
} else if (
|
|
719
|
+
} else if (s && Object.prototype.hasOwnProperty.call(s, x))
|
|
720
720
|
r = "";
|
|
721
721
|
else if (f) {
|
|
722
722
|
r = n[0];
|
|
@@ -731,8 +731,8 @@ class Me {
|
|
|
731
731
|
}
|
|
732
732
|
}), e;
|
|
733
733
|
}
|
|
734
|
-
nest(e, t,
|
|
735
|
-
let
|
|
734
|
+
nest(e, t, i = {}) {
|
|
735
|
+
let s, n, r;
|
|
736
736
|
const a = (l, u) => {
|
|
737
737
|
var x;
|
|
738
738
|
const h = this.nestingOptionsSeparator;
|
|
@@ -750,15 +750,15 @@ class Me {
|
|
|
750
750
|
}
|
|
751
751
|
return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, l;
|
|
752
752
|
};
|
|
753
|
-
for (;
|
|
753
|
+
for (; s = this.nestingRegexp.exec(e); ) {
|
|
754
754
|
let l = [];
|
|
755
|
-
r = p({},
|
|
756
|
-
const u = /{.*}/.test(
|
|
757
|
-
if (u !== -1 && (l =
|
|
755
|
+
r = p({}, i), r = r.replace && !g(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
|
|
756
|
+
const u = /{.*}/.test(s[1]) ? s[1].lastIndexOf("}") + 1 : s[1].indexOf(this.formatSeparator);
|
|
757
|
+
if (u !== -1 && (l = s[1].slice(u).split(this.formatSeparator).map((h) => h.trim()).filter(Boolean), s[1] = s[1].slice(0, u)), n = t(a.call(this, s[1].trim(), r), r), n && s[0] === e && !g(n))
|
|
758
758
|
return n;
|
|
759
|
-
g(n) || (n = ae(n)), n || (this.logger.warn(`missed to resolve ${
|
|
760
|
-
interpolationkey:
|
|
761
|
-
})), n.trim())), e = e.replace(
|
|
759
|
+
g(n) || (n = ae(n)), n || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), n = ""), l.length && (n = l.reduce((h, f) => this.format(h, f, i.lng, O(p({}, i), {
|
|
760
|
+
interpolationkey: s[1].trim()
|
|
761
|
+
})), n.trim())), e = e.replace(s[0], n), this.regexp.lastIndex = 0;
|
|
762
762
|
}
|
|
763
763
|
return e;
|
|
764
764
|
}
|
|
@@ -767,10 +767,10 @@ const Be = (o) => {
|
|
|
767
767
|
let e = o.toLowerCase().trim();
|
|
768
768
|
const t = {};
|
|
769
769
|
if (o.indexOf("(") > -1) {
|
|
770
|
-
const
|
|
771
|
-
e =
|
|
772
|
-
const
|
|
773
|
-
e === "currency" &&
|
|
770
|
+
const i = o.split("(");
|
|
771
|
+
e = i[0].toLowerCase().trim();
|
|
772
|
+
const s = i[1].substring(0, i[1].length - 1);
|
|
773
|
+
e === "currency" && s.indexOf(":") < 0 ? t.currency || (t.currency = s.trim()) : e === "relativetime" && s.indexOf(":") < 0 ? t.range || (t.range = s.trim()) : s.split(";").forEach((r) => {
|
|
774
774
|
if (r) {
|
|
775
775
|
const [a, ...l] = r.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), h = a.trim();
|
|
776
776
|
t[h] || (t[h] = u), u === "false" && (t[h] = !1), u === "true" && (t[h] = !0), isNaN(u) || (t[h] = parseInt(u, 10));
|
|
@@ -783,16 +783,16 @@ const Be = (o) => {
|
|
|
783
783
|
};
|
|
784
784
|
}, xe = (o) => {
|
|
785
785
|
const e = {};
|
|
786
|
-
return (t,
|
|
787
|
-
let n =
|
|
788
|
-
|
|
789
|
-
[
|
|
786
|
+
return (t, i, s) => {
|
|
787
|
+
let n = s;
|
|
788
|
+
s && s.interpolationkey && s.formatParams && s.formatParams[s.interpolationkey] && s[s.interpolationkey] && (n = O(p({}, n), {
|
|
789
|
+
[s.interpolationkey]: void 0
|
|
790
790
|
}));
|
|
791
|
-
const r =
|
|
791
|
+
const r = i + JSON.stringify(n);
|
|
792
792
|
let a = e[r];
|
|
793
|
-
return a || (a = o(B(
|
|
793
|
+
return a || (a = o(B(i), s), e[r] = a), a(t);
|
|
794
794
|
};
|
|
795
|
-
}, He = (o) => (e, t,
|
|
795
|
+
}, He = (o) => (e, t, i) => o(B(t), i)(e);
|
|
796
796
|
class ze {
|
|
797
797
|
constructor(e = {}) {
|
|
798
798
|
this.logger = N.create("formatter"), this.options = e, this.init(e);
|
|
@@ -801,28 +801,28 @@ class ze {
|
|
|
801
801
|
interpolation: {}
|
|
802
802
|
}) {
|
|
803
803
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
804
|
-
const
|
|
804
|
+
const i = t.cacheInBuiltFormats ? xe : He;
|
|
805
805
|
this.formats = {
|
|
806
|
-
number:
|
|
807
|
-
const r = new Intl.NumberFormat(
|
|
806
|
+
number: i((s, n) => {
|
|
807
|
+
const r = new Intl.NumberFormat(s, p({}, n));
|
|
808
808
|
return (a) => r.format(a);
|
|
809
809
|
}),
|
|
810
|
-
currency:
|
|
811
|
-
const r = new Intl.NumberFormat(
|
|
810
|
+
currency: i((s, n) => {
|
|
811
|
+
const r = new Intl.NumberFormat(s, O(p({}, n), {
|
|
812
812
|
style: "currency"
|
|
813
813
|
}));
|
|
814
814
|
return (a) => r.format(a);
|
|
815
815
|
}),
|
|
816
|
-
datetime:
|
|
817
|
-
const r = new Intl.DateTimeFormat(
|
|
816
|
+
datetime: i((s, n) => {
|
|
817
|
+
const r = new Intl.DateTimeFormat(s, p({}, n));
|
|
818
818
|
return (a) => r.format(a);
|
|
819
819
|
}),
|
|
820
|
-
relativetime:
|
|
821
|
-
const r = new Intl.RelativeTimeFormat(
|
|
820
|
+
relativetime: i((s, n) => {
|
|
821
|
+
const r = new Intl.RelativeTimeFormat(s, p({}, n));
|
|
822
822
|
return (a) => r.format(a, n.range || "day");
|
|
823
823
|
}),
|
|
824
|
-
list:
|
|
825
|
-
const r = new Intl.ListFormat(
|
|
824
|
+
list: i((s, n) => {
|
|
825
|
+
const r = new Intl.ListFormat(s, p({}, n));
|
|
826
826
|
return (a) => r.format(a);
|
|
827
827
|
})
|
|
828
828
|
};
|
|
@@ -833,7 +833,7 @@ class ze {
|
|
|
833
833
|
addCached(e, t) {
|
|
834
834
|
this.formats[e.toLowerCase().trim()] = xe(t);
|
|
835
835
|
}
|
|
836
|
-
format(e, t,
|
|
836
|
+
format(e, t, i, s = {}) {
|
|
837
837
|
const n = t.split(this.formatSeparator);
|
|
838
838
|
if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((a) => a.indexOf(")") > -1)) {
|
|
839
839
|
const a = n.findIndex((l) => l.indexOf(")") > -1);
|
|
@@ -848,8 +848,8 @@ class ze {
|
|
|
848
848
|
if (this.formats[u]) {
|
|
849
849
|
let m = a;
|
|
850
850
|
try {
|
|
851
|
-
const d = ((f =
|
|
852
|
-
m = this.formats[u](a, c, p(p(p({}, h),
|
|
851
|
+
const d = ((f = s == null ? void 0 : s.formatParams) == null ? void 0 : f[s.interpolationkey]) || {}, c = d.locale || d.lng || s.locale || s.lng || i;
|
|
852
|
+
m = this.formats[u](a, c, p(p(p({}, h), s), d));
|
|
853
853
|
} catch (d) {
|
|
854
854
|
this.logger.warn(d);
|
|
855
855
|
}
|
|
@@ -863,25 +863,25 @@ class ze {
|
|
|
863
863
|
const Je = (o, e) => {
|
|
864
864
|
o.pending[e] !== void 0 && (delete o.pending[e], o.pendingCount--);
|
|
865
865
|
};
|
|
866
|
-
class We extends
|
|
867
|
-
constructor(e, t,
|
|
866
|
+
class We extends Z {
|
|
867
|
+
constructor(e, t, i, s = {}) {
|
|
868
868
|
var n, r;
|
|
869
|
-
super(), this.backend = e, this.store = t, this.services =
|
|
869
|
+
super(), this.backend = e, this.store = t, this.services = i, this.languageUtils = i.languageUtils, this.options = s, this.logger = N.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = s.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = s.maxRetries >= 0 ? s.maxRetries : 5, this.retryTimeout = s.retryTimeout >= 1 ? s.retryTimeout : 350, this.state = {}, this.queue = [], (r = (n = this.backend) == null ? void 0 : n.init) == null || r.call(n, i, s.backend, s);
|
|
870
870
|
}
|
|
871
|
-
queueLoad(e, t,
|
|
871
|
+
queueLoad(e, t, i, s) {
|
|
872
872
|
const n = {}, r = {}, a = {}, l = {};
|
|
873
873
|
return e.forEach((u) => {
|
|
874
874
|
let h = !0;
|
|
875
875
|
t.forEach((f) => {
|
|
876
876
|
const m = `${u}|${f}`;
|
|
877
|
-
!
|
|
877
|
+
!i.reload && this.store.hasResourceBundle(u, f) ? this.state[m] = 2 : this.state[m] < 0 || (this.state[m] === 1 ? r[m] === void 0 && (r[m] = !0) : (this.state[m] = 1, h = !1, r[m] === void 0 && (r[m] = !0), n[m] === void 0 && (n[m] = !0), l[f] === void 0 && (l[f] = !0)));
|
|
878
878
|
}), h || (a[u] = !0);
|
|
879
879
|
}), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
|
|
880
880
|
pending: r,
|
|
881
881
|
pendingCount: Object.keys(r).length,
|
|
882
882
|
loaded: {},
|
|
883
883
|
errors: [],
|
|
884
|
-
callback:
|
|
884
|
+
callback: s
|
|
885
885
|
}), {
|
|
886
886
|
toLoad: Object.keys(n),
|
|
887
887
|
pending: Object.keys(r),
|
|
@@ -889,11 +889,11 @@ class We extends G {
|
|
|
889
889
|
toLoadNamespaces: Object.keys(l)
|
|
890
890
|
};
|
|
891
891
|
}
|
|
892
|
-
loaded(e, t,
|
|
893
|
-
const
|
|
894
|
-
t && this.emit("failedLoading", n, r, t), !t &&
|
|
892
|
+
loaded(e, t, i) {
|
|
893
|
+
const s = e.split("|"), n = s[0], r = s[1];
|
|
894
|
+
t && this.emit("failedLoading", n, r, t), !t && i && this.store.addResourceBundle(n, r, i, void 0, void 0, {
|
|
895
895
|
skipCopy: !0
|
|
896
|
-
}), this.state[e] = t ? -1 : 2, t &&
|
|
896
|
+
}), this.state[e] = t ? -1 : 2, t && i && (this.state[e] = 0);
|
|
897
897
|
const a = {};
|
|
898
898
|
this.queue.forEach((l) => {
|
|
899
899
|
Ee(l.loaded, [n], r), Je(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
|
|
@@ -905,15 +905,15 @@ class We extends G {
|
|
|
905
905
|
}), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
|
|
906
906
|
}), this.emit("loaded", a), this.queue = this.queue.filter((l) => !l.done);
|
|
907
907
|
}
|
|
908
|
-
read(e, t,
|
|
908
|
+
read(e, t, i, s = 0, n = this.retryTimeout, r) {
|
|
909
909
|
if (!e.length)
|
|
910
910
|
return r(null, {});
|
|
911
911
|
if (this.readingCalls >= this.maxParallelReads) {
|
|
912
912
|
this.waitingReads.push({
|
|
913
913
|
lng: e,
|
|
914
914
|
ns: t,
|
|
915
|
-
fcName:
|
|
916
|
-
tried:
|
|
915
|
+
fcName: i,
|
|
916
|
+
tried: s,
|
|
917
917
|
wait: n,
|
|
918
918
|
callback: r
|
|
919
919
|
});
|
|
@@ -925,14 +925,14 @@ class We extends G {
|
|
|
925
925
|
const f = this.waitingReads.shift();
|
|
926
926
|
this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
|
|
927
927
|
}
|
|
928
|
-
if (u && h &&
|
|
928
|
+
if (u && h && s < this.maxRetries) {
|
|
929
929
|
setTimeout(() => {
|
|
930
|
-
this.read.call(this, e, t,
|
|
930
|
+
this.read.call(this, e, t, i, s + 1, n * 2, r);
|
|
931
931
|
}, n);
|
|
932
932
|
return;
|
|
933
933
|
}
|
|
934
934
|
r(u, h);
|
|
935
|
-
}, l = this.backend[
|
|
935
|
+
}, l = this.backend[i].bind(this.backend);
|
|
936
936
|
if (l.length === 2) {
|
|
937
937
|
try {
|
|
938
938
|
const u = l(e, t);
|
|
@@ -944,39 +944,39 @@ class We extends G {
|
|
|
944
944
|
}
|
|
945
945
|
return l(e, t, a);
|
|
946
946
|
}
|
|
947
|
-
prepareLoading(e, t,
|
|
947
|
+
prepareLoading(e, t, i = {}, s) {
|
|
948
948
|
if (!this.backend)
|
|
949
|
-
return this.logger.warn("No backend was added via i18next.use. Will not load resources."),
|
|
949
|
+
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), s && s();
|
|
950
950
|
g(e) && (e = this.languageUtils.toResolveHierarchy(e)), g(t) && (t = [t]);
|
|
951
|
-
const n = this.queueLoad(e, t,
|
|
951
|
+
const n = this.queueLoad(e, t, i, s);
|
|
952
952
|
if (!n.toLoad.length)
|
|
953
|
-
return n.pending.length ||
|
|
953
|
+
return n.pending.length || s(), null;
|
|
954
954
|
n.toLoad.forEach((r) => {
|
|
955
955
|
this.loadOne(r);
|
|
956
956
|
});
|
|
957
957
|
}
|
|
958
|
-
load(e, t,
|
|
959
|
-
this.prepareLoading(e, t, {},
|
|
958
|
+
load(e, t, i) {
|
|
959
|
+
this.prepareLoading(e, t, {}, i);
|
|
960
960
|
}
|
|
961
|
-
reload(e, t,
|
|
961
|
+
reload(e, t, i) {
|
|
962
962
|
this.prepareLoading(e, t, {
|
|
963
963
|
reload: !0
|
|
964
|
-
},
|
|
964
|
+
}, i);
|
|
965
965
|
}
|
|
966
966
|
loadOne(e, t = "") {
|
|
967
|
-
const
|
|
968
|
-
this.read(
|
|
969
|
-
r && this.logger.warn(`${t}loading namespace ${n} for language ${
|
|
967
|
+
const i = e.split("|"), s = i[0], n = i[1];
|
|
968
|
+
this.read(s, n, "read", void 0, void 0, (r, a) => {
|
|
969
|
+
r && this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`, r), !r && a && this.logger.log(`${t}loaded namespace ${n} for language ${s}`, a), this.loaded(e, r, a);
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
|
-
saveMissing(e, t,
|
|
972
|
+
saveMissing(e, t, i, s, n, r = {}, a = () => {
|
|
973
973
|
}) {
|
|
974
974
|
var l, u, h, f, m;
|
|
975
975
|
if (((u = (l = this.services) == null ? void 0 : l.utils) == null ? void 0 : u.hasLoadedNamespace) && !((f = (h = this.services) == null ? void 0 : h.utils) != null && f.hasLoadedNamespace(t))) {
|
|
976
|
-
this.logger.warn(`did not save key "${
|
|
976
|
+
this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
|
|
977
977
|
return;
|
|
978
978
|
}
|
|
979
|
-
if (!(
|
|
979
|
+
if (!(i == null || i === "")) {
|
|
980
980
|
if ((m = this.backend) != null && m.create) {
|
|
981
981
|
const d = O(p({}, r), {
|
|
982
982
|
isUpdate: n
|
|
@@ -984,14 +984,14 @@ class We extends G {
|
|
|
984
984
|
if (c.length < 6)
|
|
985
985
|
try {
|
|
986
986
|
let x;
|
|
987
|
-
c.length === 5 ? x = c(e, t,
|
|
987
|
+
c.length === 5 ? x = c(e, t, i, s, d) : x = c(e, t, i, s), x && typeof x.then == "function" ? x.then((S) => a(null, S)).catch(a) : a(null, x);
|
|
988
988
|
} catch (x) {
|
|
989
989
|
a(x);
|
|
990
990
|
}
|
|
991
991
|
else
|
|
992
|
-
c(e, t,
|
|
992
|
+
c(e, t, i, s, a, d);
|
|
993
993
|
}
|
|
994
|
-
!e || !e[0] || this.store.addResource(e[0], t,
|
|
994
|
+
!e || !e[0] || this.store.addResource(e[0], t, i, s);
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
997
|
}
|
|
@@ -1032,8 +1032,8 @@ const ye = () => ({
|
|
|
1032
1032
|
let e = {};
|
|
1033
1033
|
if (typeof o[1] == "object" && (e = o[1]), g(o[1]) && (e.defaultValue = o[1]), g(o[2]) && (e.tDescription = o[2]), typeof o[2] == "object" || typeof o[3] == "object") {
|
|
1034
1034
|
const t = o[3] || o[2];
|
|
1035
|
-
Object.keys(t).forEach((
|
|
1036
|
-
e[
|
|
1035
|
+
Object.keys(t).forEach((i) => {
|
|
1036
|
+
e[i] = t[i];
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
1039
|
return e;
|
|
@@ -1061,7 +1061,7 @@ const ye = () => ({
|
|
|
1061
1061
|
typeof o[t] == "function" && (o[t] = o[t].bind(o));
|
|
1062
1062
|
});
|
|
1063
1063
|
};
|
|
1064
|
-
class H extends
|
|
1064
|
+
class H extends Z {
|
|
1065
1065
|
constructor(e = {}, t) {
|
|
1066
1066
|
if (super(), this.options = Se(e), this.services = {}, this.logger = N, this.modules = {
|
|
1067
1067
|
external: []
|
|
@@ -1075,11 +1075,11 @@ class H extends G {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
init(e = {}, t) {
|
|
1077
1077
|
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (g(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1078
|
-
const
|
|
1079
|
-
this.options = p(p(p({},
|
|
1080
|
-
const
|
|
1078
|
+
const i = ye();
|
|
1079
|
+
this.options = p(p(p({}, i), this.options), Se(e)), this.options.interpolation = p(p({}, i.interpolation), this.options.interpolation), e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator);
|
|
1080
|
+
const s = (u) => u ? typeof u == "function" ? new u() : u : null;
|
|
1081
1081
|
if (!this.options.isClone) {
|
|
1082
|
-
this.modules.logger ? N.init(
|
|
1082
|
+
this.modules.logger ? N.init(s(this.modules.logger), this.options) : N.init(null, this.options);
|
|
1083
1083
|
let u;
|
|
1084
1084
|
this.modules.formatter ? u = this.modules.formatter : u = ze;
|
|
1085
1085
|
const h = new de(this.options);
|
|
@@ -1088,11 +1088,11 @@ class H extends G {
|
|
|
1088
1088
|
f.logger = N, f.resourceStore = this.store, f.languageUtils = h, f.pluralResolver = new Ue(h, {
|
|
1089
1089
|
prepend: this.options.pluralSeparator,
|
|
1090
1090
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1091
|
-
}), this.options.interpolation.format && this.options.interpolation.format !==
|
|
1091
|
+
}), this.options.interpolation.format && this.options.interpolation.format !== i.interpolation.format && this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), u && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (f.formatter = s(u), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new Me(this.options), f.utils = {
|
|
1092
1092
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1093
|
-
}, f.backendConnector = new We(
|
|
1093
|
+
}, f.backendConnector = new We(s(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (d, ...c) => {
|
|
1094
1094
|
this.emit(d, ...c);
|
|
1095
|
-
}), this.modules.languageDetector && (f.languageDetector =
|
|
1095
|
+
}), this.modules.languageDetector && (f.languageDetector = s(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = s(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new G(this.services, this.options), this.translator.on("*", (d, ...c) => {
|
|
1096
1096
|
this.emit(d, ...c);
|
|
1097
1097
|
}), this.modules.external.forEach((d) => {
|
|
1098
1098
|
d.init && d.init(this);
|
|
@@ -1119,11 +1119,11 @@ class H extends G {
|
|
|
1119
1119
|
}
|
|
1120
1120
|
loadResources(e, t = W) {
|
|
1121
1121
|
var n, r;
|
|
1122
|
-
let
|
|
1123
|
-
const
|
|
1124
|
-
if (typeof e == "function" && (
|
|
1125
|
-
if ((
|
|
1126
|
-
return
|
|
1122
|
+
let i = t;
|
|
1123
|
+
const s = g(e) ? e : this.language;
|
|
1124
|
+
if (typeof e == "function" && (i = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1125
|
+
if ((s == null ? void 0 : s.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0))
|
|
1126
|
+
return i();
|
|
1127
1127
|
const a = [], l = (u) => {
|
|
1128
1128
|
if (!u || u === "cimode")
|
|
1129
1129
|
return;
|
|
@@ -1131,17 +1131,17 @@ class H extends G {
|
|
|
1131
1131
|
f !== "cimode" && a.indexOf(f) < 0 && a.push(f);
|
|
1132
1132
|
});
|
|
1133
1133
|
};
|
|
1134
|
-
|
|
1135
|
-
!u && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language),
|
|
1134
|
+
s ? l(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((h) => l(h)), (r = (n = this.options.preload) == null ? void 0 : n.forEach) == null || r.call(n, (u) => l(u)), this.services.backendConnector.load(a, this.options.ns, (u) => {
|
|
1135
|
+
!u && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), i(u);
|
|
1136
1136
|
});
|
|
1137
1137
|
} else
|
|
1138
|
-
|
|
1138
|
+
i(null);
|
|
1139
1139
|
}
|
|
1140
|
-
reloadResources(e, t,
|
|
1141
|
-
const
|
|
1142
|
-
return typeof e == "function" && (
|
|
1143
|
-
|
|
1144
|
-
}),
|
|
1140
|
+
reloadResources(e, t, i) {
|
|
1141
|
+
const s = U();
|
|
1142
|
+
return typeof e == "function" && (i = e, e = void 0), typeof t == "function" && (i = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), i || (i = W), this.services.backendConnector.reload(e, t, (n) => {
|
|
1143
|
+
s.resolve(), i(n);
|
|
1144
|
+
}), s;
|
|
1145
1145
|
}
|
|
1146
1146
|
use(e) {
|
|
1147
1147
|
if (!e)
|
|
@@ -1153,9 +1153,9 @@ class H extends G {
|
|
|
1153
1153
|
setResolvedLanguage(e) {
|
|
1154
1154
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
1155
1155
|
for (let t = 0; t < this.languages.length; t++) {
|
|
1156
|
-
const
|
|
1157
|
-
if (!(["cimode", "dev"].indexOf(
|
|
1158
|
-
this.resolvedLanguage =
|
|
1156
|
+
const i = this.languages[t];
|
|
1157
|
+
if (!(["cimode", "dev"].indexOf(i) > -1) && this.store.hasLanguageSomeTranslations(i)) {
|
|
1158
|
+
this.resolvedLanguage = i;
|
|
1159
1159
|
break;
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
@@ -1164,31 +1164,31 @@ class H extends G {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
changeLanguage(e, t) {
|
|
1166
1166
|
this.isLanguageChangingTo = e;
|
|
1167
|
-
const
|
|
1167
|
+
const i = U();
|
|
1168
1168
|
this.emit("languageChanging", e);
|
|
1169
|
-
const
|
|
1169
|
+
const s = (a) => {
|
|
1170
1170
|
this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
|
|
1171
1171
|
}, n = (a, l) => {
|
|
1172
|
-
l ? this.isLanguageChangingTo === e && (
|
|
1172
|
+
l ? this.isLanguageChangingTo === e && (s(l), this.translator.changeLanguage(l), this.isLanguageChangingTo = void 0, this.emit("languageChanged", l), this.logger.log("languageChanged", l)) : this.isLanguageChangingTo = void 0, i.resolve((...u) => this.t(...u)), t && t(a, (...u) => this.t(...u));
|
|
1173
1173
|
}, r = (a) => {
|
|
1174
1174
|
var h, f;
|
|
1175
1175
|
!e && !a && this.services.languageDetector && (a = []);
|
|
1176
1176
|
const l = g(a) ? a : a && a[0], u = this.store.hasLanguageSomeTranslations(l) ? l : this.services.languageUtils.getBestMatchFromCodes(g(a) ? [a] : a);
|
|
1177
|
-
u && (this.language ||
|
|
1177
|
+
u && (this.language || s(u), this.translator.language || this.translator.changeLanguage(u), (f = (h = this.services.languageDetector) == null ? void 0 : h.cacheUserLanguage) == null || f.call(h, u)), this.loadResources(u, (m) => {
|
|
1178
1178
|
n(m, u);
|
|
1179
1179
|
});
|
|
1180
1180
|
};
|
|
1181
|
-
return !e && this.services.languageDetector && !this.services.languageDetector.async ? r(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(r) : this.services.languageDetector.detect(r) : r(e),
|
|
1181
|
+
return !e && this.services.languageDetector && !this.services.languageDetector.async ? r(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(r) : this.services.languageDetector.detect(r) : r(e), i;
|
|
1182
1182
|
}
|
|
1183
|
-
getFixedT(e, t,
|
|
1184
|
-
const
|
|
1183
|
+
getFixedT(e, t, i) {
|
|
1184
|
+
const s = (n, r, ...a) => {
|
|
1185
1185
|
let l;
|
|
1186
|
-
typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(a)) : l = p({}, r), l.lng = l.lng ||
|
|
1186
|
+
typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(a)) : l = p({}, r), l.lng = l.lng || s.lng, l.lngs = l.lngs || s.lngs, l.ns = l.ns || s.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || i || s.keyPrefix);
|
|
1187
1187
|
const u = this.options.keySeparator || ".";
|
|
1188
1188
|
let h;
|
|
1189
1189
|
return l.keyPrefix && Array.isArray(n) ? h = n.map((f) => `${l.keyPrefix}${u}${f}`) : h = l.keyPrefix ? `${l.keyPrefix}${u}${n}` : n, this.t(h, l);
|
|
1190
1190
|
};
|
|
1191
|
-
return g(e) ?
|
|
1191
|
+
return g(e) ? s.lng = e : s.lngs = e, s.ns = t, s.keyPrefix = i, s;
|
|
1192
1192
|
}
|
|
1193
1193
|
t(...e) {
|
|
1194
1194
|
var t;
|
|
@@ -1206,8 +1206,8 @@ class H extends G {
|
|
|
1206
1206
|
return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1207
1207
|
if (!this.languages || !this.languages.length)
|
|
1208
1208
|
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1209
|
-
const
|
|
1210
|
-
if (
|
|
1209
|
+
const i = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
|
|
1210
|
+
if (i.toLowerCase() === "cimode")
|
|
1211
1211
|
return !0;
|
|
1212
1212
|
const r = (a, l) => {
|
|
1213
1213
|
const u = this.services.backendConnector.state[`${a}|${l}`];
|
|
@@ -1218,27 +1218,27 @@ class H extends G {
|
|
|
1218
1218
|
if (a !== void 0)
|
|
1219
1219
|
return a;
|
|
1220
1220
|
}
|
|
1221
|
-
return !!(this.hasResourceBundle(
|
|
1221
|
+
return !!(this.hasResourceBundle(i, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(i, e) && (!s || r(n, e)));
|
|
1222
1222
|
}
|
|
1223
1223
|
loadNamespaces(e, t) {
|
|
1224
|
-
const
|
|
1225
|
-
return this.options.ns ? (g(e) && (e = [e]), e.forEach((
|
|
1226
|
-
this.options.ns.indexOf(
|
|
1227
|
-
}), this.loadResources((
|
|
1228
|
-
|
|
1229
|
-
}),
|
|
1224
|
+
const i = U();
|
|
1225
|
+
return this.options.ns ? (g(e) && (e = [e]), e.forEach((s) => {
|
|
1226
|
+
this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
|
|
1227
|
+
}), this.loadResources((s) => {
|
|
1228
|
+
i.resolve(), t && t(s);
|
|
1229
|
+
}), i) : (t && t(), Promise.resolve());
|
|
1230
1230
|
}
|
|
1231
1231
|
loadLanguages(e, t) {
|
|
1232
|
-
const
|
|
1232
|
+
const i = U();
|
|
1233
1233
|
g(e) && (e = [e]);
|
|
1234
|
-
const
|
|
1235
|
-
return n.length ? (this.options.preload =
|
|
1236
|
-
|
|
1237
|
-
}),
|
|
1234
|
+
const s = this.options.preload || [], n = e.filter((r) => s.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
|
|
1235
|
+
return n.length ? (this.options.preload = s.concat(n), this.loadResources((r) => {
|
|
1236
|
+
i.resolve(), t && t(r);
|
|
1237
|
+
}), i) : (t && t(), Promise.resolve());
|
|
1238
1238
|
}
|
|
1239
1239
|
dir(e) {
|
|
1240
|
-
var
|
|
1241
|
-
if (e || (e = this.resolvedLanguage || (((
|
|
1240
|
+
var s, n;
|
|
1241
|
+
if (e || (e = this.resolvedLanguage || (((s = this.languages) == null ? void 0 : s.length) > 0 ? this.languages[0] : this.language)), !e)
|
|
1242
1242
|
return "rtl";
|
|
1243
1243
|
try {
|
|
1244
1244
|
const r = new Intl.Locale(e);
|
|
@@ -1249,29 +1249,29 @@ class H extends G {
|
|
|
1249
1249
|
}
|
|
1250
1250
|
} catch (r) {
|
|
1251
1251
|
}
|
|
1252
|
-
const t = ["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", "ckb"],
|
|
1253
|
-
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(
|
|
1252
|
+
const t = ["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", "ckb"], i = ((n = this.services) == null ? void 0 : n.languageUtils) || new de(ye());
|
|
1253
|
+
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(i.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1254
1254
|
}
|
|
1255
1255
|
static createInstance(e = {}, t) {
|
|
1256
1256
|
return new H(e, t);
|
|
1257
1257
|
}
|
|
1258
1258
|
cloneInstance(e = {}, t = W) {
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
const
|
|
1259
|
+
const i = e.forkResourceStore;
|
|
1260
|
+
i && delete e.forkResourceStore;
|
|
1261
|
+
const s = O(p(p({}, this.options), e), {
|
|
1262
1262
|
isClone: !0
|
|
1263
|
-
}), n = new H(
|
|
1263
|
+
}), n = new H(s);
|
|
1264
1264
|
if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
|
|
1265
1265
|
n[a] = this[a];
|
|
1266
1266
|
}), n.services = p({}, this.services), n.services.utils = {
|
|
1267
1267
|
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1268
|
-
},
|
|
1268
|
+
}, i) {
|
|
1269
1269
|
const a = Object.keys(this.store.data).reduce((l, u) => (l[u] = p({}, this.store.data[u]), l[u] = Object.keys(l[u]).reduce((h, f) => (h[f] = p({}, l[u][f]), h), l[u]), l), {});
|
|
1270
|
-
n.store = new fe(a,
|
|
1270
|
+
n.store = new fe(a, s), n.services.resourceStore = n.store;
|
|
1271
1271
|
}
|
|
1272
|
-
return n.translator = new
|
|
1272
|
+
return n.translator = new G(n.services, s), n.translator.on("*", (a, ...l) => {
|
|
1273
1273
|
n.emit(a, ...l);
|
|
1274
|
-
}), n.init(
|
|
1274
|
+
}), n.init(s, t), n.translator.options = s, n.translator.backendConnector.services.utils = {
|
|
1275
1275
|
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1276
1276
|
}, n;
|
|
1277
1277
|
}
|
|
@@ -1303,8 +1303,8 @@ y.loadNamespaces;
|
|
|
1303
1303
|
y.loadLanguages;
|
|
1304
1304
|
const Ye = (o, e) => {
|
|
1305
1305
|
for (const t of e) {
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1306
|
+
const i = o.find(t);
|
|
1307
|
+
i && i.each((s, n) => {
|
|
1308
1308
|
const r = globalThis.$(n);
|
|
1309
1309
|
if (r.attr("data-i18n"))
|
|
1310
1310
|
return;
|
|
@@ -1320,11 +1320,11 @@ const Ye = (o, e) => {
|
|
|
1320
1320
|
}));
|
|
1321
1321
|
});
|
|
1322
1322
|
}
|
|
1323
|
-
},
|
|
1323
|
+
}, _ = (o) => {
|
|
1324
1324
|
for (const e of o) {
|
|
1325
1325
|
const t = globalThis.$(e);
|
|
1326
|
-
t && t.each((
|
|
1327
|
-
const n = globalThis.$(
|
|
1326
|
+
t && t.each((i, s) => {
|
|
1327
|
+
const n = globalThis.$(s);
|
|
1328
1328
|
if (n.attr("data-i18n"))
|
|
1329
1329
|
return;
|
|
1330
1330
|
const r = n.text().trim();
|
|
@@ -1360,14 +1360,14 @@ const Ye = (o, e) => {
|
|
|
1360
1360
|
}
|
|
1361
1361
|
const t = e.match(/\[([^\]]+)\](.+)/);
|
|
1362
1362
|
if (t && t.length === 3) {
|
|
1363
|
-
const
|
|
1364
|
-
o.setAttribute(
|
|
1363
|
+
const i = t[1], s = t[2];
|
|
1364
|
+
o.setAttribute(i, y.t(s));
|
|
1365
1365
|
}
|
|
1366
1366
|
});
|
|
1367
1367
|
};
|
|
1368
1368
|
function Xe(o, e) {
|
|
1369
|
-
y.init(p({}, o), (
|
|
1370
|
-
e && e(y,
|
|
1369
|
+
y.init(p({}, o), (i, s) => {
|
|
1370
|
+
e && e(y, s, i);
|
|
1371
1371
|
});
|
|
1372
1372
|
let t = [];
|
|
1373
1373
|
return {
|
|
@@ -1381,9 +1381,9 @@ function Xe(o, e) {
|
|
|
1381
1381
|
priority: 1,
|
|
1382
1382
|
run: () => {
|
|
1383
1383
|
globalThis.hiprint.i18next = y, globalThis.hiprint.t = y.t;
|
|
1384
|
-
const
|
|
1385
|
-
globalThis.hiprint.languages = ["\u7B80\u4F53\u4E2D\u6587", ...
|
|
1386
|
-
y.changeLanguage(
|
|
1384
|
+
const i = Object.keys(o.resources || {});
|
|
1385
|
+
globalThis.hiprint.languages = ["\u7B80\u4F53\u4E2D\u6587", ...i], globalThis.hiprint.changeLanguage = (s, n) => {
|
|
1386
|
+
y.changeLanguage(s, (r, a) => {
|
|
1387
1387
|
n && n(r, a), Ge();
|
|
1388
1388
|
});
|
|
1389
1389
|
};
|
|
@@ -1394,17 +1394,15 @@ function Xe(o, e) {
|
|
|
1394
1394
|
name: "i18n options",
|
|
1395
1395
|
description: "\u6E32\u67D3\u5143\u7D20\u5C5E\u6027\u65F6\u505A\u591A\u8BED\u8A00\u5904\u7406",
|
|
1396
1396
|
priority: 1,
|
|
1397
|
-
run: (
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
}), Qe(s, r), r;
|
|
1407
|
-
}, s;
|
|
1397
|
+
run: (i) => {
|
|
1398
|
+
t.push(i.name);
|
|
1399
|
+
const s = i.createTarget;
|
|
1400
|
+
return i.createTarget = function(...n) {
|
|
1401
|
+
const r = s.call(i, ...n);
|
|
1402
|
+
return t.some((a) => a == i.name) && r.attr("data-name") || (r.attr({
|
|
1403
|
+
"data-name": i.name
|
|
1404
|
+
}), Qe(i, r)), r;
|
|
1405
|
+
}, i;
|
|
1408
1406
|
}
|
|
1409
1407
|
},
|
|
1410
1408
|
{
|
|
@@ -1412,15 +1410,21 @@ function Xe(o, e) {
|
|
|
1412
1410
|
name: "i18n other selector",
|
|
1413
1411
|
description: "\u5176\u4ED6UI\u9009\u62E9\u5668\u591A\u8BED\u8A00\u5904\u7406",
|
|
1414
1412
|
priority: 1,
|
|
1415
|
-
run: ({ hiprint:
|
|
1413
|
+
run: ({ hiprint: i, designerUtils: s }) => {
|
|
1416
1414
|
var a;
|
|
1417
|
-
const n = (a =
|
|
1418
|
-
n && globalThis.hinnn.event.on("PrintElementSelectEventKey_" + n, (l) => {
|
|
1415
|
+
const n = (a = s.printTemplate) == null ? void 0 : a.id;
|
|
1416
|
+
n && (globalThis.hinnn.event.on("PrintElementSelectEventKey_" + n, (l) => {
|
|
1419
1417
|
setTimeout(() => {
|
|
1420
|
-
|
|
1418
|
+
_([".printSetting .prop-tab-items .tab-title"]);
|
|
1421
1419
|
}, 0);
|
|
1422
|
-
}),
|
|
1420
|
+
}), globalThis.$(".hiprint-printPaper.design").on("contextmenu", () => {
|
|
1421
|
+
_([
|
|
1422
|
+
".hicontextmenu .hicontextmenuitem .title span",
|
|
1423
|
+
".hicontextmenu .hicontextmenuitem .nav"
|
|
1424
|
+
]);
|
|
1425
|
+
})), _([
|
|
1423
1426
|
".svp-header p",
|
|
1427
|
+
".svp-tools .tool-name",
|
|
1424
1428
|
".svp-dragbox .header span",
|
|
1425
1429
|
".preview-bar button span",
|
|
1426
1430
|
".printer-list-txt"
|
|
@@ -1432,9 +1436,9 @@ function Xe(o, e) {
|
|
|
1432
1436
|
name: "i18n preview selector",
|
|
1433
1437
|
description: "\u7EC4\u4EF6\u5185\u9884\u89C8\u9009\u62E9\u5668\u591A\u8BED\u8A00\u5904\u7406",
|
|
1434
1438
|
priority: 1,
|
|
1435
|
-
run: (
|
|
1439
|
+
run: (i) => {
|
|
1436
1440
|
setTimeout(() => {
|
|
1437
|
-
|
|
1441
|
+
_([".preview-bar button span", ".printer-list-txt"]);
|
|
1438
1442
|
}, 0);
|
|
1439
1443
|
}
|
|
1440
1444
|
}
|
|
@@ -1444,5 +1448,5 @@ function Xe(o, e) {
|
|
|
1444
1448
|
}
|
|
1445
1449
|
export {
|
|
1446
1450
|
Xe as default,
|
|
1447
|
-
|
|
1451
|
+
_ as translateBySelector
|
|
1448
1452
|
};
|