@ogcio/design-system-react 1.33.0 → 1.34.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/dist/accordion/accordion-item.js +1 -1
- package/dist/alert/alert.js +1 -1
- package/dist/alert/variants.js +1 -1
- package/dist/atoms/Button.js +1 -1
- package/dist/atoms/heading/styles.js +1 -1
- package/dist/atoms/storybook/Heading.meta.d.ts +1 -1
- package/dist/atoms/storybook/Heading.meta.js +4 -4
- package/dist/atoms/storybook/Icons.meta.d.ts +1 -1
- package/dist/atoms/storybook/Icons.meta.js +7 -7
- package/dist/atoms/storybook/InsetText.meta.d.ts +1 -1
- package/dist/atoms/storybook/InsetText.meta.js +1 -1
- package/dist/atoms/storybook/Logos.meta.d.ts +1 -1
- package/dist/atoms/storybook/Logos.meta.js +1 -1
- package/dist/autocomplete/autocomplete.js +1 -1
- package/dist/autocomplete/use-autocomplete-controller.js +2 -2
- package/dist/browser-support/browser-support.js +202 -30
- package/dist/chip/chip.js +1 -1
- package/dist/data-table/data-table-footer.js +2 -2
- package/dist/data-table/data-table-header.js +1 -1
- package/dist/data-table/data-table-selected-rows.js +1 -1
- package/dist/data-table/editable-table-cell.js +1 -1
- package/dist/details/details.js +13 -16
- package/dist/drawer/drawer.js +1 -1
- package/dist/error-text/error-text.js +1 -1
- package/dist/header/header-legacy.js +6 -6
- package/dist/header/header-next/header-next.js +3 -3
- package/dist/header/variants.js +1 -1
- package/dist/hint-text/hint-text.js +1 -1
- package/dist/i18n/config.js +2 -2
- package/dist/i18n/utility.js +1 -1
- package/dist/{i18nInstance-AYICsHJu.js → i18nInstance-DiZ0lVPL.js} +2 -2
- package/dist/i18next-zBkzxGW1.js +1388 -0
- package/dist/{index-CB-zPpNk.js → index-C7W4ssMN.js} +1 -1
- package/dist/index-DqBV2TCd.js +23108 -0
- package/dist/index.js +1 -1
- package/dist/label/label.js +1 -1
- package/dist/{lodash-82PmXrjJ.js → lodash-DTZaBYO8.js} +289 -272
- package/dist/modal/modal.content.js +1 -1
- package/dist/pagination/pagination.js +59 -56
- package/dist/progress-stepper/progress-stepper.js +1 -1
- package/dist/select/select-native.js +1 -1
- package/dist/spinner/spinner.js +1 -1
- package/dist/stack/stack.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/table/table.js +1 -1
- package/dist/tabs/variants.js +1 -1
- package/dist/toast/ds-toast.js +1 -1
- package/dist/tooltip/variants.js +1 -1
- package/dist/{useTranslation-DiBQuy8S.js → useTranslation-CRbS3UeG.js} +94 -85
- package/package.json +14 -7
- package/dist/i18next-Bfi2-LyH.js +0 -1370
- package/dist/index-Bh2cTIps.js +0 -33899
package/dist/i18next-Bfi2-LyH.js
DELETED
|
@@ -1,1370 +0,0 @@
|
|
|
1
|
-
const g = (o) => typeof o == "string", K = () => {
|
|
2
|
-
let o, e;
|
|
3
|
-
const t = new Promise((i, s) => {
|
|
4
|
-
o = i, e = s;
|
|
5
|
-
});
|
|
6
|
-
return t.resolve = o, t.reject = e, t;
|
|
7
|
-
}, ne = (o) => o == null ? "" : "" + o, Le = (o, e, t) => {
|
|
8
|
-
o.forEach((i) => {
|
|
9
|
-
e[i] && (t[i] = e[i]);
|
|
10
|
-
});
|
|
11
|
-
}, we = /###/g, re = (o) => o && o.indexOf("###") > -1 ? o.replace(we, ".") : o, ae = (o) => !o || g(o), A = (o, e, t) => {
|
|
12
|
-
const i = g(e) ? e.split(".") : e;
|
|
13
|
-
let s = 0;
|
|
14
|
-
for (; s < i.length - 1; ) {
|
|
15
|
-
if (ae(o)) return {};
|
|
16
|
-
const n = re(i[s]);
|
|
17
|
-
!o[n] && t && (o[n] = new t()), Object.prototype.hasOwnProperty.call(o, n) ? o = o[n] : o = {}, ++s;
|
|
18
|
-
}
|
|
19
|
-
return ae(o) ? {} : {
|
|
20
|
-
obj: o,
|
|
21
|
-
k: re(i[s])
|
|
22
|
-
};
|
|
23
|
-
}, oe = (o, e, t) => {
|
|
24
|
-
const {
|
|
25
|
-
obj: i,
|
|
26
|
-
k: s
|
|
27
|
-
} = A(o, e, Object);
|
|
28
|
-
if (i !== void 0 || e.length === 1) {
|
|
29
|
-
i[s] = t;
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
let n = e[e.length - 1], r = e.slice(0, e.length - 1), a = A(o, r, Object);
|
|
33
|
-
for (; a.obj === void 0 && r.length; )
|
|
34
|
-
n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1), a = A(o, r, Object), a != null && a.obj && typeof a.obj[`${a.k}.${n}`] < "u" && (a.obj = void 0);
|
|
35
|
-
a.obj[`${a.k}.${n}`] = t;
|
|
36
|
-
}, ve = (o, e, t, i) => {
|
|
37
|
-
const {
|
|
38
|
-
obj: s,
|
|
39
|
-
k: n
|
|
40
|
-
} = A(o, e, Object);
|
|
41
|
-
s[n] = s[n] || [], s[n].push(t);
|
|
42
|
-
}, J = (o, e) => {
|
|
43
|
-
const {
|
|
44
|
-
obj: t,
|
|
45
|
-
k: i
|
|
46
|
-
} = A(o, e);
|
|
47
|
-
if (t && Object.prototype.hasOwnProperty.call(t, i))
|
|
48
|
-
return t[i];
|
|
49
|
-
}, Ce = (o, e, t) => {
|
|
50
|
-
const i = J(o, t);
|
|
51
|
-
return i !== void 0 ? i : J(e, t);
|
|
52
|
-
}, xe = (o, e, t) => {
|
|
53
|
-
for (const i in e)
|
|
54
|
-
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]) : xe(o[i], e[i], t) : o[i] = e[i]);
|
|
55
|
-
return o;
|
|
56
|
-
}, I = (o) => o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
57
|
-
var Pe = {
|
|
58
|
-
"&": "&",
|
|
59
|
-
"<": "<",
|
|
60
|
-
">": ">",
|
|
61
|
-
'"': """,
|
|
62
|
-
"'": "'",
|
|
63
|
-
"/": "/"
|
|
64
|
-
};
|
|
65
|
-
const Re = (o) => g(o) ? o.replace(/[&<>"'\/]/g, (e) => Pe[e]) : o;
|
|
66
|
-
class $e {
|
|
67
|
-
constructor(e) {
|
|
68
|
-
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
69
|
-
}
|
|
70
|
-
getRegExp(e) {
|
|
71
|
-
const t = this.regExpMap.get(e);
|
|
72
|
-
if (t !== void 0)
|
|
73
|
-
return t;
|
|
74
|
-
const i = new RegExp(e);
|
|
75
|
-
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, i), this.regExpQueue.push(e), i;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const Ne = [" ", ",", "?", "!", ";"], ke = new $e(20), Fe = (o, e, t) => {
|
|
79
|
-
e = e || "", t = t || "";
|
|
80
|
-
const i = Ne.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
|
|
81
|
-
if (i.length === 0) return !0;
|
|
82
|
-
const s = ke.getRegExp(`(${i.map((r) => r === "?" ? "\\?" : r).join("|")})`);
|
|
83
|
-
let n = !s.test(o);
|
|
84
|
-
if (!n) {
|
|
85
|
-
const r = o.indexOf(t);
|
|
86
|
-
r > 0 && !s.test(o.substring(0, r)) && (n = !0);
|
|
87
|
-
}
|
|
88
|
-
return n;
|
|
89
|
-
}, X = (o, e, t = ".") => {
|
|
90
|
-
if (!o) return;
|
|
91
|
-
if (o[e])
|
|
92
|
-
return Object.prototype.hasOwnProperty.call(o, e) ? o[e] : void 0;
|
|
93
|
-
const i = e.split(t);
|
|
94
|
-
let s = o;
|
|
95
|
-
for (let n = 0; n < i.length; ) {
|
|
96
|
-
if (!s || typeof s != "object")
|
|
97
|
-
return;
|
|
98
|
-
let r, a = "";
|
|
99
|
-
for (let u = n; u < i.length; ++u)
|
|
100
|
-
if (u !== n && (a += t), a += i[u], r = s[a], r !== void 0) {
|
|
101
|
-
if (["string", "number", "boolean"].indexOf(typeof r) > -1 && u < i.length - 1)
|
|
102
|
-
continue;
|
|
103
|
-
n += u - n + 1;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
s = r;
|
|
107
|
-
}
|
|
108
|
-
return s;
|
|
109
|
-
}, H = (o) => o == null ? void 0 : o.replace("_", "-"), je = {
|
|
110
|
-
type: "logger",
|
|
111
|
-
log(o) {
|
|
112
|
-
this.output("log", o);
|
|
113
|
-
},
|
|
114
|
-
warn(o) {
|
|
115
|
-
this.output("warn", o);
|
|
116
|
-
},
|
|
117
|
-
error(o) {
|
|
118
|
-
this.output("error", o);
|
|
119
|
-
},
|
|
120
|
-
output(o, e) {
|
|
121
|
-
var t, i;
|
|
122
|
-
(i = (t = console == null ? void 0 : console[o]) == null ? void 0 : t.apply) == null || i.call(t, console, e);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
class W {
|
|
126
|
-
constructor(e, t = {}) {
|
|
127
|
-
this.init(e, t);
|
|
128
|
-
}
|
|
129
|
-
init(e, t = {}) {
|
|
130
|
-
this.prefix = t.prefix || "i18next:", this.logger = e || je, this.options = t, this.debug = t.debug;
|
|
131
|
-
}
|
|
132
|
-
log(...e) {
|
|
133
|
-
return this.forward(e, "log", "", !0);
|
|
134
|
-
}
|
|
135
|
-
warn(...e) {
|
|
136
|
-
return this.forward(e, "warn", "", !0);
|
|
137
|
-
}
|
|
138
|
-
error(...e) {
|
|
139
|
-
return this.forward(e, "error", "");
|
|
140
|
-
}
|
|
141
|
-
deprecate(...e) {
|
|
142
|
-
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
143
|
-
}
|
|
144
|
-
forward(e, t, i, s) {
|
|
145
|
-
return s && !this.debug ? null : (g(e[0]) && (e[0] = `${i}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
146
|
-
}
|
|
147
|
-
create(e) {
|
|
148
|
-
return new W(this.logger, {
|
|
149
|
-
prefix: `${this.prefix}:${e}:`,
|
|
150
|
-
...this.options
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
clone(e) {
|
|
154
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new W(this.logger, e);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
var $ = new W();
|
|
158
|
-
class _ {
|
|
159
|
-
constructor() {
|
|
160
|
-
this.observers = {};
|
|
161
|
-
}
|
|
162
|
-
on(e, t) {
|
|
163
|
-
return e.split(" ").forEach((i) => {
|
|
164
|
-
this.observers[i] || (this.observers[i] = /* @__PURE__ */ new Map());
|
|
165
|
-
const s = this.observers[i].get(t) || 0;
|
|
166
|
-
this.observers[i].set(t, s + 1);
|
|
167
|
-
}), this;
|
|
168
|
-
}
|
|
169
|
-
off(e, t) {
|
|
170
|
-
if (this.observers[e]) {
|
|
171
|
-
if (!t) {
|
|
172
|
-
delete this.observers[e];
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
this.observers[e].delete(t);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
emit(e, ...t) {
|
|
179
|
-
this.observers[e] && Array.from(this.observers[e].entries()).forEach(([s, n]) => {
|
|
180
|
-
for (let r = 0; r < n; r++)
|
|
181
|
-
s(...t);
|
|
182
|
-
}), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([s, n]) => {
|
|
183
|
-
for (let r = 0; r < n; r++)
|
|
184
|
-
s.apply(s, [e, ...t]);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
class le extends _ {
|
|
189
|
-
constructor(e, t = {
|
|
190
|
-
ns: ["translation"],
|
|
191
|
-
defaultNS: "translation"
|
|
192
|
-
}) {
|
|
193
|
-
super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
|
|
194
|
-
}
|
|
195
|
-
addNamespaces(e) {
|
|
196
|
-
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
197
|
-
}
|
|
198
|
-
removeNamespaces(e) {
|
|
199
|
-
const t = this.options.ns.indexOf(e);
|
|
200
|
-
t > -1 && this.options.ns.splice(t, 1);
|
|
201
|
-
}
|
|
202
|
-
getResource(e, t, i, s = {}) {
|
|
203
|
-
var l, h;
|
|
204
|
-
const n = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, r = s.ignoreJSONStructure !== void 0 ? s.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
205
|
-
let a;
|
|
206
|
-
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)));
|
|
207
|
-
const u = J(this.data, a);
|
|
208
|
-
return !u && !t && !i && e.indexOf(".") > -1 && (e = a[0], t = a[1], i = a.slice(2).join(".")), u || !r || !g(i) ? u : X((h = (l = this.data) == null ? void 0 : l[e]) == null ? void 0 : h[t], i, n);
|
|
209
|
-
}
|
|
210
|
-
addResource(e, t, i, s, n = {
|
|
211
|
-
silent: !1
|
|
212
|
-
}) {
|
|
213
|
-
const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
|
|
214
|
-
let a = [e, t];
|
|
215
|
-
i && (a = a.concat(r ? i.split(r) : i)), e.indexOf(".") > -1 && (a = e.split("."), s = t, t = a[1]), this.addNamespaces(t), oe(this.data, a, s), n.silent || this.emit("added", e, t, i, s);
|
|
216
|
-
}
|
|
217
|
-
addResources(e, t, i, s = {
|
|
218
|
-
silent: !1
|
|
219
|
-
}) {
|
|
220
|
-
for (const n in i)
|
|
221
|
-
(g(i[n]) || Array.isArray(i[n])) && this.addResource(e, t, n, i[n], {
|
|
222
|
-
silent: !0
|
|
223
|
-
});
|
|
224
|
-
s.silent || this.emit("added", e, t, i);
|
|
225
|
-
}
|
|
226
|
-
addResourceBundle(e, t, i, s, n, r = {
|
|
227
|
-
silent: !1,
|
|
228
|
-
skipCopy: !1
|
|
229
|
-
}) {
|
|
230
|
-
let a = [e, t];
|
|
231
|
-
e.indexOf(".") > -1 && (a = e.split("."), s = i, i = t, t = a[1]), this.addNamespaces(t);
|
|
232
|
-
let u = J(this.data, a) || {};
|
|
233
|
-
r.skipCopy || (i = JSON.parse(JSON.stringify(i))), s ? xe(u, i, n) : u = {
|
|
234
|
-
...u,
|
|
235
|
-
...i
|
|
236
|
-
}, oe(this.data, a, u), r.silent || this.emit("added", e, t, i);
|
|
237
|
-
}
|
|
238
|
-
removeResourceBundle(e, t) {
|
|
239
|
-
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
240
|
-
}
|
|
241
|
-
hasResourceBundle(e, t) {
|
|
242
|
-
return this.getResource(e, t) !== void 0;
|
|
243
|
-
}
|
|
244
|
-
getResourceBundle(e, t) {
|
|
245
|
-
return t || (t = this.options.defaultNS), this.getResource(e, t);
|
|
246
|
-
}
|
|
247
|
-
getDataByLanguage(e) {
|
|
248
|
-
return this.data[e];
|
|
249
|
-
}
|
|
250
|
-
hasLanguageSomeTranslations(e) {
|
|
251
|
-
const t = this.getDataByLanguage(e);
|
|
252
|
-
return !!(t && Object.keys(t) || []).find((s) => t[s] && Object.keys(t[s]).length > 0);
|
|
253
|
-
}
|
|
254
|
-
toJSON() {
|
|
255
|
-
return this.data;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
var ye = {
|
|
259
|
-
processors: {},
|
|
260
|
-
addPostProcessor(o) {
|
|
261
|
-
this.processors[o.name] = o;
|
|
262
|
-
},
|
|
263
|
-
handle(o, e, t, i, s) {
|
|
264
|
-
return o.forEach((n) => {
|
|
265
|
-
var r;
|
|
266
|
-
e = ((r = this.processors[n]) == null ? void 0 : r.process(e, t, i, s)) ?? e;
|
|
267
|
-
}), e;
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
const Se = Symbol("i18next/PATH_KEY");
|
|
271
|
-
function Ee() {
|
|
272
|
-
const o = [], e = /* @__PURE__ */ Object.create(null);
|
|
273
|
-
let t;
|
|
274
|
-
return e.get = (i, s) => {
|
|
275
|
-
var n;
|
|
276
|
-
return (n = t == null ? void 0 : t.revoke) == null || n.call(t), s === Se ? o : (o.push(s), t = Proxy.revocable(i, e), t.proxy);
|
|
277
|
-
}, Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
|
|
278
|
-
}
|
|
279
|
-
function q(o, e) {
|
|
280
|
-
const {
|
|
281
|
-
[Se]: t
|
|
282
|
-
} = o(Ee());
|
|
283
|
-
return t.join((e == null ? void 0 : e.keySeparator) ?? ".");
|
|
284
|
-
}
|
|
285
|
-
const ue = {}, Q = (o) => !g(o) && typeof o != "boolean" && typeof o != "number";
|
|
286
|
-
class Y extends _ {
|
|
287
|
-
constructor(e, t = {}) {
|
|
288
|
-
super(), Le(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = $.create("translator");
|
|
289
|
-
}
|
|
290
|
-
changeLanguage(e) {
|
|
291
|
-
e && (this.language = e);
|
|
292
|
-
}
|
|
293
|
-
exists(e, t = {
|
|
294
|
-
interpolation: {}
|
|
295
|
-
}) {
|
|
296
|
-
const i = {
|
|
297
|
-
...t
|
|
298
|
-
};
|
|
299
|
-
if (e == null) return !1;
|
|
300
|
-
const s = this.resolve(e, i);
|
|
301
|
-
if ((s == null ? void 0 : s.res) === void 0) return !1;
|
|
302
|
-
const n = Q(s.res);
|
|
303
|
-
return !(i.returnObjects === !1 && n);
|
|
304
|
-
}
|
|
305
|
-
extractFromKey(e, t) {
|
|
306
|
-
let i = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
|
|
307
|
-
i === void 0 && (i = ":");
|
|
308
|
-
const s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
309
|
-
let n = t.ns || this.options.defaultNS || [];
|
|
310
|
-
const r = i && e.indexOf(i) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Fe(e, i, s);
|
|
311
|
-
if (r && !a) {
|
|
312
|
-
const u = e.match(this.interpolator.nestingRegexp);
|
|
313
|
-
if (u && u.length > 0)
|
|
314
|
-
return {
|
|
315
|
-
key: e,
|
|
316
|
-
namespaces: g(n) ? [n] : n
|
|
317
|
-
};
|
|
318
|
-
const l = e.split(i);
|
|
319
|
-
(i !== s || i === s && this.options.ns.indexOf(l[0]) > -1) && (n = l.shift()), e = l.join(s);
|
|
320
|
-
}
|
|
321
|
-
return {
|
|
322
|
-
key: e,
|
|
323
|
-
namespaces: g(n) ? [n] : n
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
translate(e, t, i) {
|
|
327
|
-
let s = typeof t == "object" ? {
|
|
328
|
-
...t
|
|
329
|
-
} : t;
|
|
330
|
-
if (typeof s != "object" && this.options.overloadTranslationOptionHandler && (s = this.options.overloadTranslationOptionHandler(arguments)), typeof s == "object" && (s = {
|
|
331
|
-
...s
|
|
332
|
-
}), s || (s = {}), e == null) return "";
|
|
333
|
-
typeof e == "function" && (e = q(e, {
|
|
334
|
-
...this.options,
|
|
335
|
-
...s
|
|
336
|
-
})), Array.isArray(e) || (e = [String(e)]);
|
|
337
|
-
const n = s.returnDetails !== void 0 ? s.returnDetails : this.options.returnDetails, r = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, {
|
|
338
|
-
key: a,
|
|
339
|
-
namespaces: u
|
|
340
|
-
} = this.extractFromKey(e[e.length - 1], s), l = u[u.length - 1];
|
|
341
|
-
let h = s.nsSeparator !== void 0 ? s.nsSeparator : this.options.nsSeparator;
|
|
342
|
-
h === void 0 && (h = ":");
|
|
343
|
-
const f = s.lng || this.language, p = s.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
344
|
-
if ((f == null ? void 0 : f.toLowerCase()) === "cimode")
|
|
345
|
-
return p ? n ? {
|
|
346
|
-
res: `${l}${h}${a}`,
|
|
347
|
-
usedKey: a,
|
|
348
|
-
exactUsedKey: a,
|
|
349
|
-
usedLng: f,
|
|
350
|
-
usedNS: l,
|
|
351
|
-
usedParams: this.getUsedParamsDetails(s)
|
|
352
|
-
} : `${l}${h}${a}` : n ? {
|
|
353
|
-
res: a,
|
|
354
|
-
usedKey: a,
|
|
355
|
-
exactUsedKey: a,
|
|
356
|
-
usedLng: f,
|
|
357
|
-
usedNS: l,
|
|
358
|
-
usedParams: this.getUsedParamsDetails(s)
|
|
359
|
-
} : a;
|
|
360
|
-
const d = this.resolve(e, s);
|
|
361
|
-
let c = d == null ? void 0 : d.res;
|
|
362
|
-
const m = (d == null ? void 0 : d.usedKey) || a, x = (d == null ? void 0 : d.exactUsedKey) || a, v = ["[object Number]", "[object Function]", "[object RegExp]"], w = s.joinArrays !== void 0 ? s.joinArrays : this.options.joinArrays, j = !this.i18nFormat || this.i18nFormat.handleAsObject, S = s.count !== void 0 && !g(s.count), N = Y.hasDefaultValue(s), M = S ? this.pluralResolver.getSuffix(f, s.count, s) : "", k = s.ordinal && S ? this.pluralResolver.getSuffix(f, s.count, {
|
|
363
|
-
ordinal: !1
|
|
364
|
-
}) : "", T = S && !s.ordinal && s.count === 0, b = T && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${M}`] || s[`defaultValue${k}`] || s.defaultValue;
|
|
365
|
-
let y = c;
|
|
366
|
-
j && !c && N && (y = b);
|
|
367
|
-
const Oe = Q(y), be = Object.prototype.toString.apply(y);
|
|
368
|
-
if (j && y && Oe && v.indexOf(be) < 0 && !(g(w) && Array.isArray(y))) {
|
|
369
|
-
if (!s.returnObjects && !this.options.returnObjects) {
|
|
370
|
-
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
371
|
-
const P = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, y, {
|
|
372
|
-
...s,
|
|
373
|
-
ns: u
|
|
374
|
-
}) : `key '${a} (${this.language})' returned an object instead of string.`;
|
|
375
|
-
return n ? (d.res = P, d.usedParams = this.getUsedParamsDetails(s), d) : P;
|
|
376
|
-
}
|
|
377
|
-
if (r) {
|
|
378
|
-
const P = Array.isArray(y), C = P ? [] : {}, ee = P ? x : m;
|
|
379
|
-
for (const R in y)
|
|
380
|
-
if (Object.prototype.hasOwnProperty.call(y, R)) {
|
|
381
|
-
const F = `${ee}${r}${R}`;
|
|
382
|
-
N && !c ? C[R] = this.translate(F, {
|
|
383
|
-
...s,
|
|
384
|
-
defaultValue: Q(b) ? b[R] : void 0,
|
|
385
|
-
joinArrays: !1,
|
|
386
|
-
ns: u
|
|
387
|
-
}) : C[R] = this.translate(F, {
|
|
388
|
-
...s,
|
|
389
|
-
joinArrays: !1,
|
|
390
|
-
ns: u
|
|
391
|
-
}), C[R] === F && (C[R] = y[R]);
|
|
392
|
-
}
|
|
393
|
-
c = C;
|
|
394
|
-
}
|
|
395
|
-
} else if (j && g(w) && Array.isArray(c))
|
|
396
|
-
c = c.join(w), c && (c = this.extendTranslation(c, e, s, i));
|
|
397
|
-
else {
|
|
398
|
-
let P = !1, C = !1;
|
|
399
|
-
!this.isValidLookup(c) && N && (P = !0, c = b), this.isValidLookup(c) || (C = !0, c = a);
|
|
400
|
-
const R = (s.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && C ? void 0 : c, F = N && b !== c && this.options.updateMissing;
|
|
401
|
-
if (C || P || F) {
|
|
402
|
-
if (this.logger.log(F ? "updateKey" : "missingKey", f, l, a, F ? b : c), r) {
|
|
403
|
-
const L = this.resolve(a, {
|
|
404
|
-
...s,
|
|
405
|
-
keySeparator: !1
|
|
406
|
-
});
|
|
407
|
-
L && L.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.");
|
|
408
|
-
}
|
|
409
|
-
let D = [];
|
|
410
|
-
const B = this.languageUtils.getFallbackCodes(this.options.fallbackLng, s.lng || this.language);
|
|
411
|
-
if (this.options.saveMissingTo === "fallback" && B && B[0])
|
|
412
|
-
for (let L = 0; L < B.length; L++)
|
|
413
|
-
D.push(B[L]);
|
|
414
|
-
else this.options.saveMissingTo === "all" ? D = this.languageUtils.toResolveHierarchy(s.lng || this.language) : D.push(s.lng || this.language);
|
|
415
|
-
const te = (L, E, V) => {
|
|
416
|
-
var ie;
|
|
417
|
-
const se = N && V !== c ? V : R;
|
|
418
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(L, l, E, se, F, s) : (ie = this.backendConnector) != null && ie.saveMissing && this.backendConnector.saveMissing(L, l, E, se, F, s), this.emit("missingKey", L, l, E, c);
|
|
419
|
-
};
|
|
420
|
-
this.options.saveMissing && (this.options.saveMissingPlurals && S ? D.forEach((L) => {
|
|
421
|
-
const E = this.pluralResolver.getSuffixes(L, s);
|
|
422
|
-
T && s[`defaultValue${this.options.pluralSeparator}zero`] && E.indexOf(`${this.options.pluralSeparator}zero`) < 0 && E.push(`${this.options.pluralSeparator}zero`), E.forEach((V) => {
|
|
423
|
-
te([L], a + V, s[`defaultValue${V}`] || b);
|
|
424
|
-
});
|
|
425
|
-
}) : te(D, a, b));
|
|
426
|
-
}
|
|
427
|
-
c = this.extendTranslation(c, e, s, d, i), C && c === a && this.options.appendNamespaceToMissingKey && (c = `${l}${h}${a}`), (C || P) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${h}${a}` : a, P ? c : void 0, s));
|
|
428
|
-
}
|
|
429
|
-
return n ? (d.res = c, d.usedParams = this.getUsedParamsDetails(s), d) : c;
|
|
430
|
-
}
|
|
431
|
-
extendTranslation(e, t, i, s, n) {
|
|
432
|
-
var u, l;
|
|
433
|
-
if ((u = this.i18nFormat) != null && u.parse)
|
|
434
|
-
e = this.i18nFormat.parse(e, {
|
|
435
|
-
...this.options.interpolation.defaultVariables,
|
|
436
|
-
...i
|
|
437
|
-
}, i.lng || this.language || s.usedLng, s.usedNS, s.usedKey, {
|
|
438
|
-
resolved: s
|
|
439
|
-
});
|
|
440
|
-
else if (!i.skipInterpolation) {
|
|
441
|
-
i.interpolation && this.interpolator.init({
|
|
442
|
-
...i,
|
|
443
|
-
interpolation: {
|
|
444
|
-
...this.options.interpolation,
|
|
445
|
-
...i.interpolation
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
const h = g(e) && (((l = i == null ? void 0 : i.interpolation) == null ? void 0 : l.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
449
|
-
let f;
|
|
450
|
-
if (h) {
|
|
451
|
-
const d = e.match(this.interpolator.nestingRegexp);
|
|
452
|
-
f = d && d.length;
|
|
453
|
-
}
|
|
454
|
-
let p = i.replace && !g(i.replace) ? i.replace : i;
|
|
455
|
-
if (this.options.interpolation.defaultVariables && (p = {
|
|
456
|
-
...this.options.interpolation.defaultVariables,
|
|
457
|
-
...p
|
|
458
|
-
}), e = this.interpolator.interpolate(e, p, i.lng || this.language || s.usedLng, i), h) {
|
|
459
|
-
const d = e.match(this.interpolator.nestingRegexp), c = d && d.length;
|
|
460
|
-
f < c && (i.nest = !1);
|
|
461
|
-
}
|
|
462
|
-
!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();
|
|
463
|
-
}
|
|
464
|
-
const r = i.postProcess || this.options.postProcess, a = g(r) ? [r] : r;
|
|
465
|
-
return e != null && (a != null && a.length) && i.applyPostProcessor !== !1 && (e = ye.handle(a, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
466
|
-
i18nResolved: {
|
|
467
|
-
...s,
|
|
468
|
-
usedParams: this.getUsedParamsDetails(i)
|
|
469
|
-
},
|
|
470
|
-
...i
|
|
471
|
-
} : i, this)), e;
|
|
472
|
-
}
|
|
473
|
-
resolve(e, t = {}) {
|
|
474
|
-
let i, s, n, r, a;
|
|
475
|
-
return g(e) && (e = [e]), e.forEach((u) => {
|
|
476
|
-
if (this.isValidLookup(i)) return;
|
|
477
|
-
const l = this.extractFromKey(u, t), h = l.key;
|
|
478
|
-
s = h;
|
|
479
|
-
let f = l.namespaces;
|
|
480
|
-
this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
|
|
481
|
-
const p = t.count !== void 0 && !g(t.count), d = p && !t.ordinal && t.count === 0, c = t.context !== void 0 && (g(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
482
|
-
f.forEach((x) => {
|
|
483
|
-
var v, w;
|
|
484
|
-
this.isValidLookup(i) || (a = x, !ue[`${m[0]}-${x}`] && ((v = this.utils) != null && v.hasLoadedNamespace) && !((w = this.utils) != null && w.hasLoadedNamespace(a)) && (ue[`${m[0]}-${x}`] = !0, this.logger.warn(`key "${s}" for languages "${m.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!!!")), m.forEach((j) => {
|
|
485
|
-
var M;
|
|
486
|
-
if (this.isValidLookup(i)) return;
|
|
487
|
-
r = j;
|
|
488
|
-
const S = [h];
|
|
489
|
-
if ((M = this.i18nFormat) != null && M.addLookupKeys)
|
|
490
|
-
this.i18nFormat.addLookupKeys(S, h, j, x, t);
|
|
491
|
-
else {
|
|
492
|
-
let k;
|
|
493
|
-
p && (k = this.pluralResolver.getSuffix(j, t.count, t));
|
|
494
|
-
const T = `${this.options.pluralSeparator}zero`, b = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
495
|
-
if (p && (t.ordinal && k.indexOf(b) === 0 && S.push(h + k.replace(b, this.options.pluralSeparator)), S.push(h + k), d && S.push(h + T)), c) {
|
|
496
|
-
const y = `${h}${this.options.contextSeparator || "_"}${t.context}`;
|
|
497
|
-
S.push(y), p && (t.ordinal && k.indexOf(b) === 0 && S.push(y + k.replace(b, this.options.pluralSeparator)), S.push(y + k), d && S.push(y + T));
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
let N;
|
|
501
|
-
for (; N = S.pop(); )
|
|
502
|
-
this.isValidLookup(i) || (n = N, i = this.getResource(j, x, N, t));
|
|
503
|
-
}));
|
|
504
|
-
});
|
|
505
|
-
}), {
|
|
506
|
-
res: i,
|
|
507
|
-
usedKey: s,
|
|
508
|
-
exactUsedKey: n,
|
|
509
|
-
usedLng: r,
|
|
510
|
-
usedNS: a
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
isValidLookup(e) {
|
|
514
|
-
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
515
|
-
}
|
|
516
|
-
getResource(e, t, i, s = {}) {
|
|
517
|
-
var n;
|
|
518
|
-
return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t, i, s) : this.resourceStore.getResource(e, t, i, s);
|
|
519
|
-
}
|
|
520
|
-
getUsedParamsDetails(e = {}) {
|
|
521
|
-
const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], i = e.replace && !g(e.replace);
|
|
522
|
-
let s = i ? e.replace : e;
|
|
523
|
-
if (i && typeof e.count < "u" && (s.count = e.count), this.options.interpolation.defaultVariables && (s = {
|
|
524
|
-
...this.options.interpolation.defaultVariables,
|
|
525
|
-
...s
|
|
526
|
-
}), !i) {
|
|
527
|
-
s = {
|
|
528
|
-
...s
|
|
529
|
-
};
|
|
530
|
-
for (const n of t)
|
|
531
|
-
delete s[n];
|
|
532
|
-
}
|
|
533
|
-
return s;
|
|
534
|
-
}
|
|
535
|
-
static hasDefaultValue(e) {
|
|
536
|
-
const t = "defaultValue";
|
|
537
|
-
for (const i in e)
|
|
538
|
-
if (Object.prototype.hasOwnProperty.call(e, i) && t === i.substring(0, t.length) && e[i] !== void 0)
|
|
539
|
-
return !0;
|
|
540
|
-
return !1;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
class fe {
|
|
544
|
-
constructor(e) {
|
|
545
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = $.create("languageUtils");
|
|
546
|
-
}
|
|
547
|
-
getScriptPartFromCode(e) {
|
|
548
|
-
if (e = H(e), !e || e.indexOf("-") < 0) return null;
|
|
549
|
-
const t = e.split("-");
|
|
550
|
-
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
551
|
-
}
|
|
552
|
-
getLanguagePartFromCode(e) {
|
|
553
|
-
if (e = H(e), !e || e.indexOf("-") < 0) return e;
|
|
554
|
-
const t = e.split("-");
|
|
555
|
-
return this.formatLanguageCode(t[0]);
|
|
556
|
-
}
|
|
557
|
-
formatLanguageCode(e) {
|
|
558
|
-
if (g(e) && e.indexOf("-") > -1) {
|
|
559
|
-
let t;
|
|
560
|
-
try {
|
|
561
|
-
t = Intl.getCanonicalLocales(e)[0];
|
|
562
|
-
} catch {
|
|
563
|
-
}
|
|
564
|
-
return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
|
|
565
|
-
}
|
|
566
|
-
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
567
|
-
}
|
|
568
|
-
isSupportedCode(e) {
|
|
569
|
-
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
|
|
570
|
-
}
|
|
571
|
-
getBestMatchFromCodes(e) {
|
|
572
|
-
if (!e) return null;
|
|
573
|
-
let t;
|
|
574
|
-
return e.forEach((i) => {
|
|
575
|
-
if (t) return;
|
|
576
|
-
const s = this.formatLanguageCode(i);
|
|
577
|
-
(!this.options.supportedLngs || this.isSupportedCode(s)) && (t = s);
|
|
578
|
-
}), !t && this.options.supportedLngs && e.forEach((i) => {
|
|
579
|
-
if (t) return;
|
|
580
|
-
const s = this.getScriptPartFromCode(i);
|
|
581
|
-
if (this.isSupportedCode(s)) return t = s;
|
|
582
|
-
const n = this.getLanguagePartFromCode(i);
|
|
583
|
-
if (this.isSupportedCode(n)) return t = n;
|
|
584
|
-
t = this.options.supportedLngs.find((r) => {
|
|
585
|
-
if (r === n) return r;
|
|
586
|
-
if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && (r.indexOf("-") > 0 && n.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === n || r.indexOf(n) === 0 && n.length > 1))
|
|
587
|
-
return r;
|
|
588
|
-
});
|
|
589
|
-
}), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
|
|
590
|
-
}
|
|
591
|
-
getFallbackCodes(e, t) {
|
|
592
|
-
if (!e) return [];
|
|
593
|
-
if (typeof e == "function" && (e = e(t)), g(e) && (e = [e]), Array.isArray(e)) return e;
|
|
594
|
-
if (!t) return e.default || [];
|
|
595
|
-
let i = e[t];
|
|
596
|
-
return i || (i = e[this.getScriptPartFromCode(t)]), i || (i = e[this.formatLanguageCode(t)]), i || (i = e[this.getLanguagePartFromCode(t)]), i || (i = e.default), i || [];
|
|
597
|
-
}
|
|
598
|
-
toResolveHierarchy(e, t) {
|
|
599
|
-
const i = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), s = [], n = (r) => {
|
|
600
|
-
r && (this.isSupportedCode(r) ? s.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
|
|
601
|
-
};
|
|
602
|
-
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) => {
|
|
603
|
-
s.indexOf(r) < 0 && n(this.formatLanguageCode(r));
|
|
604
|
-
}), s;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
const he = {
|
|
608
|
-
zero: 0,
|
|
609
|
-
one: 1,
|
|
610
|
-
two: 2,
|
|
611
|
-
few: 3,
|
|
612
|
-
many: 4,
|
|
613
|
-
other: 5
|
|
614
|
-
}, ce = {
|
|
615
|
-
select: (o) => o === 1 ? "one" : "other",
|
|
616
|
-
resolvedOptions: () => ({
|
|
617
|
-
pluralCategories: ["one", "other"]
|
|
618
|
-
})
|
|
619
|
-
};
|
|
620
|
-
class Ie {
|
|
621
|
-
constructor(e, t = {}) {
|
|
622
|
-
this.languageUtils = e, this.options = t, this.logger = $.create("pluralResolver"), this.pluralRulesCache = {};
|
|
623
|
-
}
|
|
624
|
-
clearCache() {
|
|
625
|
-
this.pluralRulesCache = {};
|
|
626
|
-
}
|
|
627
|
-
getRule(e, t = {}) {
|
|
628
|
-
const i = H(e === "dev" ? "en" : e), s = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
|
|
629
|
-
cleanedCode: i,
|
|
630
|
-
type: s
|
|
631
|
-
});
|
|
632
|
-
if (n in this.pluralRulesCache)
|
|
633
|
-
return this.pluralRulesCache[n];
|
|
634
|
-
let r;
|
|
635
|
-
try {
|
|
636
|
-
r = new Intl.PluralRules(i, {
|
|
637
|
-
type: s
|
|
638
|
-
});
|
|
639
|
-
} catch {
|
|
640
|
-
if (!Intl)
|
|
641
|
-
return this.logger.error("No Intl support, please use an Intl polyfill!"), ce;
|
|
642
|
-
if (!e.match(/-|_/)) return ce;
|
|
643
|
-
const u = this.languageUtils.getLanguagePartFromCode(e);
|
|
644
|
-
r = this.getRule(u, t);
|
|
645
|
-
}
|
|
646
|
-
return this.pluralRulesCache[n] = r, r;
|
|
647
|
-
}
|
|
648
|
-
needsPlural(e, t = {}) {
|
|
649
|
-
let i = this.getRule(e, t);
|
|
650
|
-
return i || (i = this.getRule("dev", t)), (i == null ? void 0 : i.resolvedOptions().pluralCategories.length) > 1;
|
|
651
|
-
}
|
|
652
|
-
getPluralFormsOfKey(e, t, i = {}) {
|
|
653
|
-
return this.getSuffixes(e, i).map((s) => `${t}${s}`);
|
|
654
|
-
}
|
|
655
|
-
getSuffixes(e, t = {}) {
|
|
656
|
-
let i = this.getRule(e, t);
|
|
657
|
-
return i || (i = this.getRule("dev", t)), i ? i.resolvedOptions().pluralCategories.sort((s, n) => he[s] - he[n]).map((s) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${s}`) : [];
|
|
658
|
-
}
|
|
659
|
-
getSuffix(e, t, i = {}) {
|
|
660
|
-
const s = this.getRule(e, i);
|
|
661
|
-
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));
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
const de = (o, e, t, i = ".", s = !0) => {
|
|
665
|
-
let n = Ce(o, e, t);
|
|
666
|
-
return !n && s && g(t) && (n = X(o, t, i), n === void 0 && (n = X(e, t, i))), n;
|
|
667
|
-
}, G = (o) => o.replace(/\$/g, "$$$$");
|
|
668
|
-
class ge {
|
|
669
|
-
constructor(e = {}) {
|
|
670
|
-
var t;
|
|
671
|
-
this.logger = $.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((i) => i), this.init(e);
|
|
672
|
-
}
|
|
673
|
-
init(e = {}) {
|
|
674
|
-
e.interpolation || (e.interpolation = {
|
|
675
|
-
escapeValue: !0
|
|
676
|
-
});
|
|
677
|
-
const {
|
|
678
|
-
escape: t,
|
|
679
|
-
escapeValue: i,
|
|
680
|
-
useRawValueToEscape: s,
|
|
681
|
-
prefix: n,
|
|
682
|
-
prefixEscaped: r,
|
|
683
|
-
suffix: a,
|
|
684
|
-
suffixEscaped: u,
|
|
685
|
-
formatSeparator: l,
|
|
686
|
-
unescapeSuffix: h,
|
|
687
|
-
unescapePrefix: f,
|
|
688
|
-
nestingPrefix: p,
|
|
689
|
-
nestingPrefixEscaped: d,
|
|
690
|
-
nestingSuffix: c,
|
|
691
|
-
nestingSuffixEscaped: m,
|
|
692
|
-
nestingOptionsSeparator: x,
|
|
693
|
-
maxReplaces: v,
|
|
694
|
-
alwaysFormat: w
|
|
695
|
-
} = e.interpolation;
|
|
696
|
-
this.escape = t !== void 0 ? t : Re, 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) : u || "}}", this.formatSeparator = l || ",", this.unescapePrefix = h ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = p ? I(p) : d || I("$t("), this.nestingSuffix = c ? I(c) : m || I(")"), this.nestingOptionsSeparator = x || ",", this.maxReplaces = v || 1e3, this.alwaysFormat = w !== void 0 ? w : !1, this.resetRegExp();
|
|
697
|
-
}
|
|
698
|
-
reset() {
|
|
699
|
-
this.options && this.init(this.options);
|
|
700
|
-
}
|
|
701
|
-
resetRegExp() {
|
|
702
|
-
const e = (t, i) => (t == null ? void 0 : t.source) === i ? (t.lastIndex = 0, t) : new RegExp(i, "g");
|
|
703
|
-
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}`);
|
|
704
|
-
}
|
|
705
|
-
interpolate(e, t, i, s) {
|
|
706
|
-
var d;
|
|
707
|
-
let n, r, a;
|
|
708
|
-
const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, l = (c) => {
|
|
709
|
-
if (c.indexOf(this.formatSeparator) < 0) {
|
|
710
|
-
const w = de(t, u, c, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
711
|
-
return this.alwaysFormat ? this.format(w, void 0, i, {
|
|
712
|
-
...s,
|
|
713
|
-
...t,
|
|
714
|
-
interpolationkey: c
|
|
715
|
-
}) : w;
|
|
716
|
-
}
|
|
717
|
-
const m = c.split(this.formatSeparator), x = m.shift().trim(), v = m.join(this.formatSeparator).trim();
|
|
718
|
-
return this.format(de(t, u, x, this.options.keySeparator, this.options.ignoreJSONStructure), v, i, {
|
|
719
|
-
...s,
|
|
720
|
-
...t,
|
|
721
|
-
interpolationkey: x
|
|
722
|
-
});
|
|
723
|
-
};
|
|
724
|
-
this.resetRegExp();
|
|
725
|
-
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;
|
|
726
|
-
return [{
|
|
727
|
-
regex: this.regexpUnescape,
|
|
728
|
-
safeValue: (c) => G(c)
|
|
729
|
-
}, {
|
|
730
|
-
regex: this.regexp,
|
|
731
|
-
safeValue: (c) => this.escapeValue ? G(this.escape(c)) : G(c)
|
|
732
|
-
}].forEach((c) => {
|
|
733
|
-
for (a = 0; n = c.regex.exec(e); ) {
|
|
734
|
-
const m = n[1].trim();
|
|
735
|
-
if (r = l(m), r === void 0)
|
|
736
|
-
if (typeof h == "function") {
|
|
737
|
-
const v = h(e, n, s);
|
|
738
|
-
r = g(v) ? v : "";
|
|
739
|
-
} else if (s && Object.prototype.hasOwnProperty.call(s, m))
|
|
740
|
-
r = "";
|
|
741
|
-
else if (f) {
|
|
742
|
-
r = n[0];
|
|
743
|
-
continue;
|
|
744
|
-
} else
|
|
745
|
-
this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`), r = "";
|
|
746
|
-
else !g(r) && !this.useRawValueToEscape && (r = ne(r));
|
|
747
|
-
const x = c.safeValue(r);
|
|
748
|
-
if (e = e.replace(n[0], x), f ? (c.regex.lastIndex += r.length, c.regex.lastIndex -= n[0].length) : c.regex.lastIndex = 0, a++, a >= this.maxReplaces)
|
|
749
|
-
break;
|
|
750
|
-
}
|
|
751
|
-
}), e;
|
|
752
|
-
}
|
|
753
|
-
nest(e, t, i = {}) {
|
|
754
|
-
let s, n, r;
|
|
755
|
-
const a = (u, l) => {
|
|
756
|
-
const h = this.nestingOptionsSeparator;
|
|
757
|
-
if (u.indexOf(h) < 0) return u;
|
|
758
|
-
const f = u.split(new RegExp(`${h}[ ]*{`));
|
|
759
|
-
let p = `{${f[1]}`;
|
|
760
|
-
u = f[0], p = this.interpolate(p, r);
|
|
761
|
-
const d = p.match(/'/g), c = p.match(/"/g);
|
|
762
|
-
(((d == null ? void 0 : d.length) ?? 0) % 2 === 0 && !c || c.length % 2 !== 0) && (p = p.replace(/'/g, '"'));
|
|
763
|
-
try {
|
|
764
|
-
r = JSON.parse(p), l && (r = {
|
|
765
|
-
...l,
|
|
766
|
-
...r
|
|
767
|
-
});
|
|
768
|
-
} catch (m) {
|
|
769
|
-
return this.logger.warn(`failed parsing options string in nesting for key ${u}`, m), `${u}${h}${p}`;
|
|
770
|
-
}
|
|
771
|
-
return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, u;
|
|
772
|
-
};
|
|
773
|
-
for (; s = this.nestingRegexp.exec(e); ) {
|
|
774
|
-
let u = [];
|
|
775
|
-
r = {
|
|
776
|
-
...i
|
|
777
|
-
}, r = r.replace && !g(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
|
|
778
|
-
const l = /{.*}/.test(s[1]) ? s[1].lastIndexOf("}") + 1 : s[1].indexOf(this.formatSeparator);
|
|
779
|
-
if (l !== -1 && (u = s[1].slice(l).split(this.formatSeparator).map((h) => h.trim()).filter(Boolean), s[1] = s[1].slice(0, l)), n = t(a.call(this, s[1].trim(), r), r), n && s[0] === e && !g(n)) return n;
|
|
780
|
-
g(n) || (n = ne(n)), n || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), n = ""), u.length && (n = u.reduce((h, f) => this.format(h, f, i.lng, {
|
|
781
|
-
...i,
|
|
782
|
-
interpolationkey: s[1].trim()
|
|
783
|
-
}), n.trim())), e = e.replace(s[0], n), this.regexp.lastIndex = 0;
|
|
784
|
-
}
|
|
785
|
-
return e;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
const Te = (o) => {
|
|
789
|
-
let e = o.toLowerCase().trim();
|
|
790
|
-
const t = {};
|
|
791
|
-
if (o.indexOf("(") > -1) {
|
|
792
|
-
const i = o.split("(");
|
|
793
|
-
e = i[0].toLowerCase().trim();
|
|
794
|
-
const s = i[1].substring(0, i[1].length - 1);
|
|
795
|
-
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) => {
|
|
796
|
-
if (r) {
|
|
797
|
-
const [a, ...u] = r.split(":"), l = u.join(":").trim().replace(/^'+|'+$/g, ""), h = a.trim();
|
|
798
|
-
t[h] || (t[h] = l), l === "false" && (t[h] = !1), l === "true" && (t[h] = !0), isNaN(l) || (t[h] = parseInt(l, 10));
|
|
799
|
-
}
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
return {
|
|
803
|
-
formatName: e,
|
|
804
|
-
formatOptions: t
|
|
805
|
-
};
|
|
806
|
-
}, pe = (o) => {
|
|
807
|
-
const e = {};
|
|
808
|
-
return (t, i, s) => {
|
|
809
|
-
let n = s;
|
|
810
|
-
s && s.interpolationkey && s.formatParams && s.formatParams[s.interpolationkey] && s[s.interpolationkey] && (n = {
|
|
811
|
-
...n,
|
|
812
|
-
[s.interpolationkey]: void 0
|
|
813
|
-
});
|
|
814
|
-
const r = i + JSON.stringify(n);
|
|
815
|
-
let a = e[r];
|
|
816
|
-
return a || (a = o(H(i), s), e[r] = a), a(t);
|
|
817
|
-
};
|
|
818
|
-
}, De = (o) => (e, t, i) => o(H(t), i)(e);
|
|
819
|
-
class Ve {
|
|
820
|
-
constructor(e = {}) {
|
|
821
|
-
this.logger = $.create("formatter"), this.options = e, this.init(e);
|
|
822
|
-
}
|
|
823
|
-
init(e, t = {
|
|
824
|
-
interpolation: {}
|
|
825
|
-
}) {
|
|
826
|
-
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
827
|
-
const i = t.cacheInBuiltFormats ? pe : De;
|
|
828
|
-
this.formats = {
|
|
829
|
-
number: i((s, n) => {
|
|
830
|
-
const r = new Intl.NumberFormat(s, {
|
|
831
|
-
...n
|
|
832
|
-
});
|
|
833
|
-
return (a) => r.format(a);
|
|
834
|
-
}),
|
|
835
|
-
currency: i((s, n) => {
|
|
836
|
-
const r = new Intl.NumberFormat(s, {
|
|
837
|
-
...n,
|
|
838
|
-
style: "currency"
|
|
839
|
-
});
|
|
840
|
-
return (a) => r.format(a);
|
|
841
|
-
}),
|
|
842
|
-
datetime: i((s, n) => {
|
|
843
|
-
const r = new Intl.DateTimeFormat(s, {
|
|
844
|
-
...n
|
|
845
|
-
});
|
|
846
|
-
return (a) => r.format(a);
|
|
847
|
-
}),
|
|
848
|
-
relativetime: i((s, n) => {
|
|
849
|
-
const r = new Intl.RelativeTimeFormat(s, {
|
|
850
|
-
...n
|
|
851
|
-
});
|
|
852
|
-
return (a) => r.format(a, n.range || "day");
|
|
853
|
-
}),
|
|
854
|
-
list: i((s, n) => {
|
|
855
|
-
const r = new Intl.ListFormat(s, {
|
|
856
|
-
...n
|
|
857
|
-
});
|
|
858
|
-
return (a) => r.format(a);
|
|
859
|
-
})
|
|
860
|
-
};
|
|
861
|
-
}
|
|
862
|
-
add(e, t) {
|
|
863
|
-
this.formats[e.toLowerCase().trim()] = t;
|
|
864
|
-
}
|
|
865
|
-
addCached(e, t) {
|
|
866
|
-
this.formats[e.toLowerCase().trim()] = pe(t);
|
|
867
|
-
}
|
|
868
|
-
format(e, t, i, s = {}) {
|
|
869
|
-
const n = t.split(this.formatSeparator);
|
|
870
|
-
if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((a) => a.indexOf(")") > -1)) {
|
|
871
|
-
const a = n.findIndex((u) => u.indexOf(")") > -1);
|
|
872
|
-
n[0] = [n[0], ...n.splice(1, a)].join(this.formatSeparator);
|
|
873
|
-
}
|
|
874
|
-
return n.reduce((a, u) => {
|
|
875
|
-
var f;
|
|
876
|
-
const {
|
|
877
|
-
formatName: l,
|
|
878
|
-
formatOptions: h
|
|
879
|
-
} = Te(u);
|
|
880
|
-
if (this.formats[l]) {
|
|
881
|
-
let p = a;
|
|
882
|
-
try {
|
|
883
|
-
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;
|
|
884
|
-
p = this.formats[l](a, c, {
|
|
885
|
-
...h,
|
|
886
|
-
...s,
|
|
887
|
-
...d
|
|
888
|
-
});
|
|
889
|
-
} catch (d) {
|
|
890
|
-
this.logger.warn(d);
|
|
891
|
-
}
|
|
892
|
-
return p;
|
|
893
|
-
} else
|
|
894
|
-
this.logger.warn(`there was no format function for ${l}`);
|
|
895
|
-
return a;
|
|
896
|
-
}, e);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
const Ke = (o, e) => {
|
|
900
|
-
o.pending[e] !== void 0 && (delete o.pending[e], o.pendingCount--);
|
|
901
|
-
};
|
|
902
|
-
class Ae extends _ {
|
|
903
|
-
constructor(e, t, i, s = {}) {
|
|
904
|
-
var n, r;
|
|
905
|
-
super(), this.backend = e, this.store = t, this.services = i, this.languageUtils = i.languageUtils, this.options = s, this.logger = $.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);
|
|
906
|
-
}
|
|
907
|
-
queueLoad(e, t, i, s) {
|
|
908
|
-
const n = {}, r = {}, a = {}, u = {};
|
|
909
|
-
return e.forEach((l) => {
|
|
910
|
-
let h = !0;
|
|
911
|
-
t.forEach((f) => {
|
|
912
|
-
const p = `${l}|${f}`;
|
|
913
|
-
!i.reload && this.store.hasResourceBundle(l, f) ? this.state[p] = 2 : this.state[p] < 0 || (this.state[p] === 1 ? r[p] === void 0 && (r[p] = !0) : (this.state[p] = 1, h = !1, r[p] === void 0 && (r[p] = !0), n[p] === void 0 && (n[p] = !0), u[f] === void 0 && (u[f] = !0)));
|
|
914
|
-
}), h || (a[l] = !0);
|
|
915
|
-
}), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
|
|
916
|
-
pending: r,
|
|
917
|
-
pendingCount: Object.keys(r).length,
|
|
918
|
-
loaded: {},
|
|
919
|
-
errors: [],
|
|
920
|
-
callback: s
|
|
921
|
-
}), {
|
|
922
|
-
toLoad: Object.keys(n),
|
|
923
|
-
pending: Object.keys(r),
|
|
924
|
-
toLoadLanguages: Object.keys(a),
|
|
925
|
-
toLoadNamespaces: Object.keys(u)
|
|
926
|
-
};
|
|
927
|
-
}
|
|
928
|
-
loaded(e, t, i) {
|
|
929
|
-
const s = e.split("|"), n = s[0], r = s[1];
|
|
930
|
-
t && this.emit("failedLoading", n, r, t), !t && i && this.store.addResourceBundle(n, r, i, void 0, void 0, {
|
|
931
|
-
skipCopy: !0
|
|
932
|
-
}), this.state[e] = t ? -1 : 2, t && i && (this.state[e] = 0);
|
|
933
|
-
const a = {};
|
|
934
|
-
this.queue.forEach((u) => {
|
|
935
|
-
ve(u.loaded, [n], r), Ke(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((l) => {
|
|
936
|
-
a[l] || (a[l] = {});
|
|
937
|
-
const h = u.loaded[l];
|
|
938
|
-
h.length && h.forEach((f) => {
|
|
939
|
-
a[l][f] === void 0 && (a[l][f] = !0);
|
|
940
|
-
});
|
|
941
|
-
}), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
|
|
942
|
-
}), this.emit("loaded", a), this.queue = this.queue.filter((u) => !u.done);
|
|
943
|
-
}
|
|
944
|
-
read(e, t, i, s = 0, n = this.retryTimeout, r) {
|
|
945
|
-
if (!e.length) return r(null, {});
|
|
946
|
-
if (this.readingCalls >= this.maxParallelReads) {
|
|
947
|
-
this.waitingReads.push({
|
|
948
|
-
lng: e,
|
|
949
|
-
ns: t,
|
|
950
|
-
fcName: i,
|
|
951
|
-
tried: s,
|
|
952
|
-
wait: n,
|
|
953
|
-
callback: r
|
|
954
|
-
});
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
this.readingCalls++;
|
|
958
|
-
const a = (l, h) => {
|
|
959
|
-
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
960
|
-
const f = this.waitingReads.shift();
|
|
961
|
-
this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
|
|
962
|
-
}
|
|
963
|
-
if (l && h && s < this.maxRetries) {
|
|
964
|
-
setTimeout(() => {
|
|
965
|
-
this.read.call(this, e, t, i, s + 1, n * 2, r);
|
|
966
|
-
}, n);
|
|
967
|
-
return;
|
|
968
|
-
}
|
|
969
|
-
r(l, h);
|
|
970
|
-
}, u = this.backend[i].bind(this.backend);
|
|
971
|
-
if (u.length === 2) {
|
|
972
|
-
try {
|
|
973
|
-
const l = u(e, t);
|
|
974
|
-
l && typeof l.then == "function" ? l.then((h) => a(null, h)).catch(a) : a(null, l);
|
|
975
|
-
} catch (l) {
|
|
976
|
-
a(l);
|
|
977
|
-
}
|
|
978
|
-
return;
|
|
979
|
-
}
|
|
980
|
-
return u(e, t, a);
|
|
981
|
-
}
|
|
982
|
-
prepareLoading(e, t, i = {}, s) {
|
|
983
|
-
if (!this.backend)
|
|
984
|
-
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), s && s();
|
|
985
|
-
g(e) && (e = this.languageUtils.toResolveHierarchy(e)), g(t) && (t = [t]);
|
|
986
|
-
const n = this.queueLoad(e, t, i, s);
|
|
987
|
-
if (!n.toLoad.length)
|
|
988
|
-
return n.pending.length || s(), null;
|
|
989
|
-
n.toLoad.forEach((r) => {
|
|
990
|
-
this.loadOne(r);
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
load(e, t, i) {
|
|
994
|
-
this.prepareLoading(e, t, {}, i);
|
|
995
|
-
}
|
|
996
|
-
reload(e, t, i) {
|
|
997
|
-
this.prepareLoading(e, t, {
|
|
998
|
-
reload: !0
|
|
999
|
-
}, i);
|
|
1000
|
-
}
|
|
1001
|
-
loadOne(e, t = "") {
|
|
1002
|
-
const i = e.split("|"), s = i[0], n = i[1];
|
|
1003
|
-
this.read(s, n, "read", void 0, void 0, (r, a) => {
|
|
1004
|
-
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);
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
|
-
saveMissing(e, t, i, s, n, r = {}, a = () => {
|
|
1008
|
-
}) {
|
|
1009
|
-
var u, l, h, f, p;
|
|
1010
|
-
if ((l = (u = this.services) == null ? void 0 : u.utils) != null && l.hasLoadedNamespace && !((f = (h = this.services) == null ? void 0 : h.utils) != null && f.hasLoadedNamespace(t))) {
|
|
1011
|
-
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!!!");
|
|
1012
|
-
return;
|
|
1013
|
-
}
|
|
1014
|
-
if (!(i == null || i === "")) {
|
|
1015
|
-
if ((p = this.backend) != null && p.create) {
|
|
1016
|
-
const d = {
|
|
1017
|
-
...r,
|
|
1018
|
-
isUpdate: n
|
|
1019
|
-
}, c = this.backend.create.bind(this.backend);
|
|
1020
|
-
if (c.length < 6)
|
|
1021
|
-
try {
|
|
1022
|
-
let m;
|
|
1023
|
-
c.length === 5 ? m = c(e, t, i, s, d) : m = c(e, t, i, s), m && typeof m.then == "function" ? m.then((x) => a(null, x)).catch(a) : a(null, m);
|
|
1024
|
-
} catch (m) {
|
|
1025
|
-
a(m);
|
|
1026
|
-
}
|
|
1027
|
-
else
|
|
1028
|
-
c(e, t, i, s, a, d);
|
|
1029
|
-
}
|
|
1030
|
-
!e || !e[0] || this.store.addResource(e[0], t, i, s);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
const Z = () => ({
|
|
1035
|
-
debug: !1,
|
|
1036
|
-
initAsync: !0,
|
|
1037
|
-
ns: ["translation"],
|
|
1038
|
-
defaultNS: ["translation"],
|
|
1039
|
-
fallbackLng: ["dev"],
|
|
1040
|
-
fallbackNS: !1,
|
|
1041
|
-
supportedLngs: !1,
|
|
1042
|
-
nonExplicitSupportedLngs: !1,
|
|
1043
|
-
load: "all",
|
|
1044
|
-
preload: !1,
|
|
1045
|
-
simplifyPluralSuffix: !0,
|
|
1046
|
-
keySeparator: ".",
|
|
1047
|
-
nsSeparator: ":",
|
|
1048
|
-
pluralSeparator: "_",
|
|
1049
|
-
contextSeparator: "_",
|
|
1050
|
-
partialBundledLanguages: !1,
|
|
1051
|
-
saveMissing: !1,
|
|
1052
|
-
updateMissing: !1,
|
|
1053
|
-
saveMissingTo: "fallback",
|
|
1054
|
-
saveMissingPlurals: !0,
|
|
1055
|
-
missingKeyHandler: !1,
|
|
1056
|
-
missingInterpolationHandler: !1,
|
|
1057
|
-
postProcess: !1,
|
|
1058
|
-
postProcessPassResolved: !1,
|
|
1059
|
-
returnNull: !1,
|
|
1060
|
-
returnEmptyString: !0,
|
|
1061
|
-
returnObjects: !1,
|
|
1062
|
-
joinArrays: !1,
|
|
1063
|
-
returnedObjectHandler: !1,
|
|
1064
|
-
parseMissingKeyHandler: !1,
|
|
1065
|
-
appendNamespaceToMissingKey: !1,
|
|
1066
|
-
appendNamespaceToCIMode: !1,
|
|
1067
|
-
overloadTranslationOptionHandler: (o) => {
|
|
1068
|
-
let e = {};
|
|
1069
|
-
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") {
|
|
1070
|
-
const t = o[3] || o[2];
|
|
1071
|
-
Object.keys(t).forEach((i) => {
|
|
1072
|
-
e[i] = t[i];
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
return e;
|
|
1076
|
-
},
|
|
1077
|
-
interpolation: {
|
|
1078
|
-
escapeValue: !0,
|
|
1079
|
-
format: (o) => o,
|
|
1080
|
-
prefix: "{{",
|
|
1081
|
-
suffix: "}}",
|
|
1082
|
-
formatSeparator: ",",
|
|
1083
|
-
unescapePrefix: "-",
|
|
1084
|
-
nestingPrefix: "$t(",
|
|
1085
|
-
nestingSuffix: ")",
|
|
1086
|
-
nestingOptionsSeparator: ",",
|
|
1087
|
-
maxReplaces: 1e3,
|
|
1088
|
-
skipOnVariables: !0
|
|
1089
|
-
},
|
|
1090
|
-
cacheInBuiltFormats: !0
|
|
1091
|
-
}), me = (o) => {
|
|
1092
|
-
var e, t;
|
|
1093
|
-
return g(o.ns) && (o.ns = [o.ns]), g(o.fallbackLng) && (o.fallbackLng = [o.fallbackLng]), g(o.fallbackNS) && (o.fallbackNS = [o.fallbackNS]), ((t = (e = o.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (o.supportedLngs = o.supportedLngs.concat(["cimode"])), typeof o.initImmediate == "boolean" && (o.initAsync = o.initImmediate), o;
|
|
1094
|
-
}, z = () => {
|
|
1095
|
-
}, Ue = (o) => {
|
|
1096
|
-
Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach((t) => {
|
|
1097
|
-
typeof o[t] == "function" && (o[t] = o[t].bind(o));
|
|
1098
|
-
});
|
|
1099
|
-
};
|
|
1100
|
-
class U extends _ {
|
|
1101
|
-
constructor(e = {}, t) {
|
|
1102
|
-
if (super(), this.options = me(e), this.services = {}, this.logger = $, this.modules = {
|
|
1103
|
-
external: []
|
|
1104
|
-
}, Ue(this), t && !this.isInitialized && !e.isClone) {
|
|
1105
|
-
if (!this.options.initAsync)
|
|
1106
|
-
return this.init(e, t), this;
|
|
1107
|
-
setTimeout(() => {
|
|
1108
|
-
this.init(e, t);
|
|
1109
|
-
}, 0);
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
init(e = {}, t) {
|
|
1113
|
-
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]));
|
|
1114
|
-
const i = Z();
|
|
1115
|
-
this.options = {
|
|
1116
|
-
...i,
|
|
1117
|
-
...this.options,
|
|
1118
|
-
...me(e)
|
|
1119
|
-
}, this.options.interpolation = {
|
|
1120
|
-
...i.interpolation,
|
|
1121
|
-
...this.options.interpolation
|
|
1122
|
-
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = i.overloadTranslationOptionHandler);
|
|
1123
|
-
const s = (l) => l ? typeof l == "function" ? new l() : l : null;
|
|
1124
|
-
if (!this.options.isClone) {
|
|
1125
|
-
this.modules.logger ? $.init(s(this.modules.logger), this.options) : $.init(null, this.options);
|
|
1126
|
-
let l;
|
|
1127
|
-
this.modules.formatter ? l = this.modules.formatter : l = Ve;
|
|
1128
|
-
const h = new fe(this.options);
|
|
1129
|
-
this.store = new le(this.options.resources, this.options);
|
|
1130
|
-
const f = this.services;
|
|
1131
|
-
f.logger = $, f.resourceStore = this.store, f.languageUtils = h, f.pluralResolver = new Ie(h, {
|
|
1132
|
-
prepend: this.options.pluralSeparator,
|
|
1133
|
-
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1134
|
-
}), this.options.interpolation.format && this.options.interpolation.format !== i.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), l && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (f.formatter = s(l), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new ge(this.options), f.utils = {
|
|
1135
|
-
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1136
|
-
}, f.backendConnector = new Ae(s(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (d, ...c) => {
|
|
1137
|
-
this.emit(d, ...c);
|
|
1138
|
-
}), 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 Y(this.services, this.options), this.translator.on("*", (d, ...c) => {
|
|
1139
|
-
this.emit(d, ...c);
|
|
1140
|
-
}), this.modules.external.forEach((d) => {
|
|
1141
|
-
d.init && d.init(this);
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
if (this.format = this.options.interpolation.format, t || (t = z), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1145
|
-
const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1146
|
-
l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
|
|
1147
|
-
}
|
|
1148
|
-
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((l) => {
|
|
1149
|
-
this[l] = (...h) => this.store[l](...h);
|
|
1150
|
-
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((l) => {
|
|
1151
|
-
this[l] = (...h) => (this.store[l](...h), this);
|
|
1152
|
-
});
|
|
1153
|
-
const a = K(), u = () => {
|
|
1154
|
-
const l = (h, f) => {
|
|
1155
|
-
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), a.resolve(f), t(h, f);
|
|
1156
|
-
};
|
|
1157
|
-
if (this.languages && !this.isInitialized) return l(null, this.t.bind(this));
|
|
1158
|
-
this.changeLanguage(this.options.lng, l);
|
|
1159
|
-
};
|
|
1160
|
-
return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), a;
|
|
1161
|
-
}
|
|
1162
|
-
loadResources(e, t = z) {
|
|
1163
|
-
var n, r;
|
|
1164
|
-
let i = t;
|
|
1165
|
-
const s = g(e) ? e : this.language;
|
|
1166
|
-
if (typeof e == "function" && (i = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1167
|
-
if ((s == null ? void 0 : s.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return i();
|
|
1168
|
-
const a = [], u = (l) => {
|
|
1169
|
-
if (!l || l === "cimode") return;
|
|
1170
|
-
this.services.languageUtils.toResolveHierarchy(l).forEach((f) => {
|
|
1171
|
-
f !== "cimode" && a.indexOf(f) < 0 && a.push(f);
|
|
1172
|
-
});
|
|
1173
|
-
};
|
|
1174
|
-
s ? u(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((h) => u(h)), (r = (n = this.options.preload) == null ? void 0 : n.forEach) == null || r.call(n, (l) => u(l)), this.services.backendConnector.load(a, this.options.ns, (l) => {
|
|
1175
|
-
!l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), i(l);
|
|
1176
|
-
});
|
|
1177
|
-
} else
|
|
1178
|
-
i(null);
|
|
1179
|
-
}
|
|
1180
|
-
reloadResources(e, t, i) {
|
|
1181
|
-
const s = K();
|
|
1182
|
-
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 = z), this.services.backendConnector.reload(e, t, (n) => {
|
|
1183
|
-
s.resolve(), i(n);
|
|
1184
|
-
}), s;
|
|
1185
|
-
}
|
|
1186
|
-
use(e) {
|
|
1187
|
-
if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1188
|
-
if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1189
|
-
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" && ye.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1190
|
-
}
|
|
1191
|
-
setResolvedLanguage(e) {
|
|
1192
|
-
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
1193
|
-
for (let t = 0; t < this.languages.length; t++) {
|
|
1194
|
-
const i = this.languages[t];
|
|
1195
|
-
if (!(["cimode", "dev"].indexOf(i) > -1) && this.store.hasLanguageSomeTranslations(i)) {
|
|
1196
|
-
this.resolvedLanguage = i;
|
|
1197
|
-
break;
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
!this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
changeLanguage(e, t) {
|
|
1204
|
-
this.isLanguageChangingTo = e;
|
|
1205
|
-
const i = K();
|
|
1206
|
-
this.emit("languageChanging", e);
|
|
1207
|
-
const s = (a) => {
|
|
1208
|
-
this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
|
|
1209
|
-
}, n = (a, u) => {
|
|
1210
|
-
u ? this.isLanguageChangingTo === e && (s(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, i.resolve((...l) => this.t(...l)), t && t(a, (...l) => this.t(...l));
|
|
1211
|
-
}, r = (a) => {
|
|
1212
|
-
var h, f;
|
|
1213
|
-
!e && !a && this.services.languageDetector && (a = []);
|
|
1214
|
-
const u = g(a) ? a : a && a[0], l = this.store.hasLanguageSomeTranslations(u) ? u : this.services.languageUtils.getBestMatchFromCodes(g(a) ? [a] : a);
|
|
1215
|
-
l && (this.language || s(l), this.translator.language || this.translator.changeLanguage(l), (f = (h = this.services.languageDetector) == null ? void 0 : h.cacheUserLanguage) == null || f.call(h, l)), this.loadResources(l, (p) => {
|
|
1216
|
-
n(p, l);
|
|
1217
|
-
});
|
|
1218
|
-
};
|
|
1219
|
-
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;
|
|
1220
|
-
}
|
|
1221
|
-
getFixedT(e, t, i) {
|
|
1222
|
-
const s = (n, r, ...a) => {
|
|
1223
|
-
let u;
|
|
1224
|
-
typeof r != "object" ? u = this.options.overloadTranslationOptionHandler([n, r].concat(a)) : u = {
|
|
1225
|
-
...r
|
|
1226
|
-
}, u.lng = u.lng || s.lng, u.lngs = u.lngs || s.lngs, u.ns = u.ns || s.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || i || s.keyPrefix);
|
|
1227
|
-
const l = this.options.keySeparator || ".";
|
|
1228
|
-
let h;
|
|
1229
|
-
return u.keyPrefix && Array.isArray(n) ? h = n.map((f) => (typeof f == "function" && (f = q(f, {
|
|
1230
|
-
...this.options,
|
|
1231
|
-
...r
|
|
1232
|
-
})), `${u.keyPrefix}${l}${f}`)) : (typeof n == "function" && (n = q(n, {
|
|
1233
|
-
...this.options,
|
|
1234
|
-
...r
|
|
1235
|
-
})), h = u.keyPrefix ? `${u.keyPrefix}${l}${n}` : n), this.t(h, u);
|
|
1236
|
-
};
|
|
1237
|
-
return g(e) ? s.lng = e : s.lngs = e, s.ns = t, s.keyPrefix = i, s;
|
|
1238
|
-
}
|
|
1239
|
-
t(...e) {
|
|
1240
|
-
var t;
|
|
1241
|
-
return (t = this.translator) == null ? void 0 : t.translate(...e);
|
|
1242
|
-
}
|
|
1243
|
-
exists(...e) {
|
|
1244
|
-
var t;
|
|
1245
|
-
return (t = this.translator) == null ? void 0 : t.exists(...e);
|
|
1246
|
-
}
|
|
1247
|
-
setDefaultNamespace(e) {
|
|
1248
|
-
this.options.defaultNS = e;
|
|
1249
|
-
}
|
|
1250
|
-
hasLoadedNamespace(e, t = {}) {
|
|
1251
|
-
if (!this.isInitialized)
|
|
1252
|
-
return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1253
|
-
if (!this.languages || !this.languages.length)
|
|
1254
|
-
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1255
|
-
const i = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
|
|
1256
|
-
if (i.toLowerCase() === "cimode") return !0;
|
|
1257
|
-
const r = (a, u) => {
|
|
1258
|
-
const l = this.services.backendConnector.state[`${a}|${u}`];
|
|
1259
|
-
return l === -1 || l === 0 || l === 2;
|
|
1260
|
-
};
|
|
1261
|
-
if (t.precheck) {
|
|
1262
|
-
const a = t.precheck(this, r);
|
|
1263
|
-
if (a !== void 0) return a;
|
|
1264
|
-
}
|
|
1265
|
-
return !!(this.hasResourceBundle(i, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(i, e) && (!s || r(n, e)));
|
|
1266
|
-
}
|
|
1267
|
-
loadNamespaces(e, t) {
|
|
1268
|
-
const i = K();
|
|
1269
|
-
return this.options.ns ? (g(e) && (e = [e]), e.forEach((s) => {
|
|
1270
|
-
this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
|
|
1271
|
-
}), this.loadResources((s) => {
|
|
1272
|
-
i.resolve(), t && t(s);
|
|
1273
|
-
}), i) : (t && t(), Promise.resolve());
|
|
1274
|
-
}
|
|
1275
|
-
loadLanguages(e, t) {
|
|
1276
|
-
const i = K();
|
|
1277
|
-
g(e) && (e = [e]);
|
|
1278
|
-
const s = this.options.preload || [], n = e.filter((r) => s.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
|
|
1279
|
-
return n.length ? (this.options.preload = s.concat(n), this.loadResources((r) => {
|
|
1280
|
-
i.resolve(), t && t(r);
|
|
1281
|
-
}), i) : (t && t(), Promise.resolve());
|
|
1282
|
-
}
|
|
1283
|
-
dir(e) {
|
|
1284
|
-
var s, n;
|
|
1285
|
-
if (e || (e = this.resolvedLanguage || (((s = this.languages) == null ? void 0 : s.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
|
|
1286
|
-
try {
|
|
1287
|
-
const r = new Intl.Locale(e);
|
|
1288
|
-
if (r && r.getTextInfo) {
|
|
1289
|
-
const a = r.getTextInfo();
|
|
1290
|
-
if (a && a.direction) return a.direction;
|
|
1291
|
-
}
|
|
1292
|
-
} catch {
|
|
1293
|
-
}
|
|
1294
|
-
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 fe(Z());
|
|
1295
|
-
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(i.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1296
|
-
}
|
|
1297
|
-
static createInstance(e = {}, t) {
|
|
1298
|
-
const i = new U(e, t);
|
|
1299
|
-
return i.createInstance = U.createInstance, i;
|
|
1300
|
-
}
|
|
1301
|
-
cloneInstance(e = {}, t = z) {
|
|
1302
|
-
const i = e.forkResourceStore;
|
|
1303
|
-
i && delete e.forkResourceStore;
|
|
1304
|
-
const s = {
|
|
1305
|
-
...this.options,
|
|
1306
|
-
...e,
|
|
1307
|
-
isClone: !0
|
|
1308
|
-
}, n = new U(s);
|
|
1309
|
-
if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
|
|
1310
|
-
n[a] = this[a];
|
|
1311
|
-
}), n.services = {
|
|
1312
|
-
...this.services
|
|
1313
|
-
}, n.services.utils = {
|
|
1314
|
-
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1315
|
-
}, i) {
|
|
1316
|
-
const a = Object.keys(this.store.data).reduce((u, l) => (u[l] = {
|
|
1317
|
-
...this.store.data[l]
|
|
1318
|
-
}, u[l] = Object.keys(u[l]).reduce((h, f) => (h[f] = {
|
|
1319
|
-
...u[l][f]
|
|
1320
|
-
}, h), u[l]), u), {});
|
|
1321
|
-
n.store = new le(a, s), n.services.resourceStore = n.store;
|
|
1322
|
-
}
|
|
1323
|
-
if (e.interpolation) {
|
|
1324
|
-
const u = {
|
|
1325
|
-
...Z().interpolation,
|
|
1326
|
-
...this.options.interpolation,
|
|
1327
|
-
...e.interpolation
|
|
1328
|
-
}, l = {
|
|
1329
|
-
...s,
|
|
1330
|
-
interpolation: u
|
|
1331
|
-
};
|
|
1332
|
-
n.services.interpolator = new ge(l);
|
|
1333
|
-
}
|
|
1334
|
-
return n.translator = new Y(n.services, s), n.translator.on("*", (a, ...u) => {
|
|
1335
|
-
n.emit(a, ...u);
|
|
1336
|
-
}), n.init(s, t), n.translator.options = s, n.translator.backendConnector.services.utils = {
|
|
1337
|
-
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1338
|
-
}, n;
|
|
1339
|
-
}
|
|
1340
|
-
toJSON() {
|
|
1341
|
-
return {
|
|
1342
|
-
options: this.options,
|
|
1343
|
-
store: this.store,
|
|
1344
|
-
language: this.language,
|
|
1345
|
-
languages: this.languages,
|
|
1346
|
-
resolvedLanguage: this.resolvedLanguage
|
|
1347
|
-
};
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
const O = U.createInstance();
|
|
1351
|
-
O.createInstance;
|
|
1352
|
-
O.dir;
|
|
1353
|
-
O.init;
|
|
1354
|
-
O.loadResources;
|
|
1355
|
-
O.reloadResources;
|
|
1356
|
-
const He = O.use;
|
|
1357
|
-
O.changeLanguage;
|
|
1358
|
-
O.getFixedT;
|
|
1359
|
-
const Me = O.t;
|
|
1360
|
-
O.exists;
|
|
1361
|
-
O.setDefaultNamespace;
|
|
1362
|
-
O.hasLoadedNamespace;
|
|
1363
|
-
O.loadNamespaces;
|
|
1364
|
-
O.loadLanguages;
|
|
1365
|
-
export {
|
|
1366
|
-
O as i,
|
|
1367
|
-
q as k,
|
|
1368
|
-
Me as t,
|
|
1369
|
-
He as u
|
|
1370
|
-
};
|