@deriv-com/translations 1.4.0 → 1.4.3
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/chunk-CzZxQCTN.js +14 -0
- package/dist/components/index.js +2 -4
- package/dist/components/localize.js +18 -386
- package/dist/hooks/index.js +2 -4
- package/dist/hooks/use-translations.js +23 -20
- package/dist/index.js +9 -16
- package/dist/jsx-runtime-22qKqdB2.js +180 -0
- package/dist/provider/index.js +2 -5
- package/dist/provider/translation-provider.js +26 -46
- package/dist/{components → src/components}/localize.d.ts +2 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/{provider → src/provider}/translation-provider.d.ts +1 -1
- package/dist/{utils → src/utils}/lang-utils.d.ts +1 -1
- package/dist/utils/constants.js +34 -6
- package/dist/utils/index.js +5 -14
- package/dist/utils/initialize-i18n.js +2 -34
- package/dist/utils/lang-utils.js +2 -31
- package/dist/utils/localize.js +48 -9
- package/dist/utils/otasdk.js +19 -20
- package/dist/utils-CvIwp1ax.js +50 -0
- package/package.json +29 -28
- package/dist/constants-HKuDWVkt.js +0 -37
- package/dist/crc32-BeCcwohL.js +0 -1556
- package/dist/i18nInstance-D3STmr24.js +0 -55
- package/dist/index.d.ts +0 -4
- package/dist/jsx-runtime-oIKL5WiM.js +0 -634
- package/dist/useTranslation-CZfO55Z-.js +0 -129
- package/dist/utils/__tests__/lang-utils.spec.d.ts +0 -1
- /package/dist/{components → src/components}/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/use-translations.d.ts +0 -0
- /package/dist/{provider → src/provider}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/constants.d.ts +0 -0
- /package/dist/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/initialize-i18n.d.ts +0 -0
- /package/dist/{utils → src/utils}/localize.d.ts +0 -0
- /package/dist/{utils → src/utils}/otasdk.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), n = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
}, r = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
10
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
11
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { n, r, t };
|
package/dist/components/index.js
CHANGED
|
@@ -1,386 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
link: !0,
|
|
20
|
-
meta: !0,
|
|
21
|
-
param: !0,
|
|
22
|
-
source: !0,
|
|
23
|
-
track: !0,
|
|
24
|
-
wbr: !0
|
|
25
|
-
}), I;
|
|
26
|
-
}
|
|
27
|
-
var se = ne();
|
|
28
|
-
const re = /* @__PURE__ */ te(se);
|
|
29
|
-
var oe = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
|
|
30
|
-
function S(e) {
|
|
31
|
-
var t = { type: "tag", name: "", voidElement: !1, attrs: {}, children: [] }, n = e.match(/<\/?([^\s]+?)[/\s>]/);
|
|
32
|
-
if (n && (t.name = n[1], (re[n[1]] || e.charAt(e.length - 2) === "/") && (t.voidElement = !0), t.name.startsWith("!--"))) {
|
|
33
|
-
var o = e.indexOf("-->");
|
|
34
|
-
return { type: "comment", comment: o !== -1 ? e.slice(4, o) : "" };
|
|
35
|
-
}
|
|
36
|
-
for (var p = new RegExp(oe), s = null; (s = p.exec(e)) !== null; ) if (s[0].trim()) if (s[1]) {
|
|
37
|
-
var i = s[1].trim(), a = [i, ""];
|
|
38
|
-
i.indexOf("=") > -1 && (a = i.split("=")), t.attrs[a[0]] = a[1], p.lastIndex--;
|
|
39
|
-
} else s[2] && (t.attrs[s[2]] = s[3].trim().substring(1, s[3].length - 1));
|
|
40
|
-
return t;
|
|
41
|
-
}
|
|
42
|
-
var ae = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, ie = /^\s*$/, le = /* @__PURE__ */ Object.create(null);
|
|
43
|
-
function W(e, t) {
|
|
44
|
-
switch (t.type) {
|
|
45
|
-
case "text":
|
|
46
|
-
return e + t.content;
|
|
47
|
-
case "tag":
|
|
48
|
-
return e += "<" + t.name + (t.attrs ? function(n) {
|
|
49
|
-
var o = [];
|
|
50
|
-
for (var p in n) o.push(p + '="' + n[p] + '"');
|
|
51
|
-
return o.length ? " " + o.join(" ") : "";
|
|
52
|
-
}(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(W, "") + "</" + t.name + ">";
|
|
53
|
-
case "comment":
|
|
54
|
-
return e + "<!--" + t.comment + "-->";
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
var pe = { parse: function(e, t) {
|
|
58
|
-
t || (t = {}), t.components || (t.components = le);
|
|
59
|
-
var n, o = [], p = [], s = -1, i = !1;
|
|
60
|
-
if (e.indexOf("<") !== 0) {
|
|
61
|
-
var a = e.indexOf("<");
|
|
62
|
-
o.push({ type: "text", content: a === -1 ? e : e.substring(0, a) });
|
|
63
|
-
}
|
|
64
|
-
return e.replace(ae, function(f, c) {
|
|
65
|
-
if (i) {
|
|
66
|
-
if (f !== "</" + n.name + ">") return;
|
|
67
|
-
i = !1;
|
|
68
|
-
}
|
|
69
|
-
var g, E = f.charAt(1) !== "/", j = f.startsWith("<!--"), b = c + f.length, x = e.charAt(b);
|
|
70
|
-
if (j) {
|
|
71
|
-
var h = S(f);
|
|
72
|
-
return s < 0 ? (o.push(h), o) : ((g = p[s]).children.push(h), o);
|
|
73
|
-
}
|
|
74
|
-
if (E && (s++, (n = S(f)).type === "tag" && t.components[n.name] && (n.type = "component", i = !0), n.voidElement || i || !x || x === "<" || n.children.push({ type: "text", content: e.slice(b, e.indexOf("<", b)) }), s === 0 && o.push(n), (g = p[s - 1]) && g.children.push(n), p[s] = n), (!E || n.voidElement) && (s > -1 && (n.voidElement || n.name === f.slice(2, -1)) && (s--, n = s === -1 ? o : p[s]), !i && x !== "<" && x)) {
|
|
75
|
-
g = s === -1 ? o : p[s].children;
|
|
76
|
-
var m = e.indexOf("<", b), u = e.slice(b, m === -1 ? void 0 : m);
|
|
77
|
-
ie.test(u) && (u = " "), (m > -1 && s + g.length >= 0 || u !== " ") && g.push({ type: "text", content: u });
|
|
78
|
-
}
|
|
79
|
-
}), o;
|
|
80
|
-
}, stringify: function(e) {
|
|
81
|
-
return e.reduce(function(t, n) {
|
|
82
|
-
return t + W("", n);
|
|
83
|
-
}, "");
|
|
84
|
-
} };
|
|
85
|
-
function K(e, t) {
|
|
86
|
-
if (!e) return !1;
|
|
87
|
-
const n = e.props ? e.props.children : e.children;
|
|
88
|
-
return t ? n.length > 0 : !!n;
|
|
89
|
-
}
|
|
90
|
-
function H(e) {
|
|
91
|
-
if (!e) return [];
|
|
92
|
-
const t = e.props ? e.props.children : e.children;
|
|
93
|
-
return e.props && e.props.i18nIsDynamicList ? F(t) : t;
|
|
94
|
-
}
|
|
95
|
-
function ue(e) {
|
|
96
|
-
return Object.prototype.toString.call(e) !== "[object Array]" ? !1 : e.every((t) => D(t));
|
|
97
|
-
}
|
|
98
|
-
function F(e) {
|
|
99
|
-
return Array.isArray(e) ? e : [e];
|
|
100
|
-
}
|
|
101
|
-
function ce(e, t) {
|
|
102
|
-
const n = {
|
|
103
|
-
...t
|
|
104
|
-
};
|
|
105
|
-
return n.props = Object.assign(e.props, t.props), n;
|
|
106
|
-
}
|
|
107
|
-
function z(e, t) {
|
|
108
|
-
if (!e) return "";
|
|
109
|
-
let n = "";
|
|
110
|
-
const o = F(e), p = t.transSupportBasicHtmlNodes && t.transKeepBasicHtmlNodesFor ? t.transKeepBasicHtmlNodesFor : [];
|
|
111
|
-
return o.forEach((s, i) => {
|
|
112
|
-
if (typeof s == "string")
|
|
113
|
-
n += `${s}`;
|
|
114
|
-
else if (D(s)) {
|
|
115
|
-
const a = Object.keys(s.props).length, f = p.indexOf(s.type) > -1, c = s.props.children;
|
|
116
|
-
if (!c && f && a === 0)
|
|
117
|
-
n += `<${s.type}/>`;
|
|
118
|
-
else if (!c && (!f || a !== 0))
|
|
119
|
-
n += `<${i}></${i}>`;
|
|
120
|
-
else if (s.props.i18nIsDynamicList)
|
|
121
|
-
n += `<${i}></${i}>`;
|
|
122
|
-
else if (f && a === 1 && typeof c == "string")
|
|
123
|
-
n += `<${s.type}>${c}</${s.type}>`;
|
|
124
|
-
else {
|
|
125
|
-
const g = z(c, t);
|
|
126
|
-
n += `<${i}>${g}</${i}>`;
|
|
127
|
-
}
|
|
128
|
-
} else if (s === null)
|
|
129
|
-
V("Trans: the passed in value is invalid - seems you passed in a null child.");
|
|
130
|
-
else if (typeof s == "object") {
|
|
131
|
-
const {
|
|
132
|
-
format: a,
|
|
133
|
-
...f
|
|
134
|
-
} = s, c = Object.keys(f);
|
|
135
|
-
if (c.length === 1) {
|
|
136
|
-
const g = a ? `${c[0]}, ${a}` : c[0];
|
|
137
|
-
n += `{{${g}}}`;
|
|
138
|
-
} else
|
|
139
|
-
V("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", s);
|
|
140
|
-
} else
|
|
141
|
-
V("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.", s);
|
|
142
|
-
}), n;
|
|
143
|
-
}
|
|
144
|
-
function fe(e, t, n, o, p, s) {
|
|
145
|
-
if (t === "") return [];
|
|
146
|
-
const i = o.transKeepBasicHtmlNodesFor || [], a = t && new RegExp(i.map((m) => `<${m}`).join("|")).test(t);
|
|
147
|
-
if (!e && !a && !s) return [t];
|
|
148
|
-
const f = {};
|
|
149
|
-
function c(m) {
|
|
150
|
-
F(m).forEach((l) => {
|
|
151
|
-
typeof l != "string" && (K(l) ? c(H(l)) : typeof l == "object" && !D(l) && Object.assign(f, l));
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
c(e);
|
|
155
|
-
const g = pe.parse(`<0>${t}</0>`), E = {
|
|
156
|
-
...f,
|
|
157
|
-
...p
|
|
158
|
-
};
|
|
159
|
-
function j(m, u, l) {
|
|
160
|
-
const v = H(m), O = x(v, u.children, l);
|
|
161
|
-
return ue(v) && O.length === 0 || m.props && m.props.i18nIsDynamicList ? v : O;
|
|
162
|
-
}
|
|
163
|
-
function b(m, u, l, v, O) {
|
|
164
|
-
m.dummy ? (m.children = u, l.push(J(m, {
|
|
165
|
-
key: v
|
|
166
|
-
}, O ? void 0 : u))) : l.push(...U.map([m], (y) => {
|
|
167
|
-
const r = {
|
|
168
|
-
...y.props
|
|
169
|
-
};
|
|
170
|
-
return delete r.i18nIsDynamicList, T(y.type, {
|
|
171
|
-
...r,
|
|
172
|
-
key: v,
|
|
173
|
-
ref: y.ref
|
|
174
|
-
}, O ? null : u);
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
function x(m, u, l) {
|
|
178
|
-
const v = F(m);
|
|
179
|
-
return F(u).reduce((y, r, k) => {
|
|
180
|
-
const A = r.children && r.children[0] && r.children[0].content && n.services.interpolator.interpolate(r.children[0].content, E, n.language);
|
|
181
|
-
if (r.type === "tag") {
|
|
182
|
-
let w = v[parseInt(r.name, 10)];
|
|
183
|
-
l.length === 1 && !w && (w = l[0][r.name]), w || (w = {});
|
|
184
|
-
const d = Object.keys(r.attrs).length !== 0 ? ce({
|
|
185
|
-
props: r.attrs
|
|
186
|
-
}, w) : w, N = D(d), C = N && K(r, !0) && !r.voidElement, P = a && typeof d == "object" && d.dummy && !N, R = typeof e == "object" && e !== null && Object.hasOwnProperty.call(e, r.name);
|
|
187
|
-
if (typeof d == "string") {
|
|
188
|
-
const $ = n.services.interpolator.interpolate(d, E, n.language);
|
|
189
|
-
y.push($);
|
|
190
|
-
} else if (K(d) || C) {
|
|
191
|
-
const $ = j(d, r, l);
|
|
192
|
-
b(d, $, y, k);
|
|
193
|
-
} else if (P) {
|
|
194
|
-
const $ = x(v, r.children, l);
|
|
195
|
-
b(d, $, y, k);
|
|
196
|
-
} else if (Number.isNaN(parseFloat(r.name)))
|
|
197
|
-
if (R) {
|
|
198
|
-
const $ = j(d, r, l);
|
|
199
|
-
b(d, $, y, k, r.voidElement);
|
|
200
|
-
} else if (o.transSupportBasicHtmlNodes && i.indexOf(r.name) > -1)
|
|
201
|
-
if (r.voidElement)
|
|
202
|
-
y.push(T(r.name, {
|
|
203
|
-
key: `${r.name}-${k}`
|
|
204
|
-
}));
|
|
205
|
-
else {
|
|
206
|
-
const $ = x(v, r.children, l);
|
|
207
|
-
y.push(T(r.name, {
|
|
208
|
-
key: `${r.name}-${k}`
|
|
209
|
-
}, $));
|
|
210
|
-
}
|
|
211
|
-
else if (r.voidElement)
|
|
212
|
-
y.push(`<${r.name} />`);
|
|
213
|
-
else {
|
|
214
|
-
const $ = x(v, r.children, l);
|
|
215
|
-
y.push(`<${r.name}>${$}</${r.name}>`);
|
|
216
|
-
}
|
|
217
|
-
else if (typeof d == "object" && !N) {
|
|
218
|
-
const $ = r.children[0] ? A : null;
|
|
219
|
-
$ && y.push($);
|
|
220
|
-
} else
|
|
221
|
-
b(d, A, y, k, r.children.length !== 1 || !A);
|
|
222
|
-
} else if (r.type === "text") {
|
|
223
|
-
const w = o.transWrapTextNodes, d = s ? o.unescape(n.services.interpolator.interpolate(r.content, E, n.language)) : n.services.interpolator.interpolate(r.content, E, n.language);
|
|
224
|
-
w ? y.push(T(w, {
|
|
225
|
-
key: `${r.name}-${k}`
|
|
226
|
-
}, d)) : y.push(d);
|
|
227
|
-
}
|
|
228
|
-
return y;
|
|
229
|
-
}, []);
|
|
230
|
-
}
|
|
231
|
-
const h = x([{
|
|
232
|
-
dummy: !0,
|
|
233
|
-
children: e || []
|
|
234
|
-
}], g, F(e || []));
|
|
235
|
-
return H(h[0]);
|
|
236
|
-
}
|
|
237
|
-
function me(e) {
|
|
238
|
-
let {
|
|
239
|
-
children: t,
|
|
240
|
-
count: n,
|
|
241
|
-
parent: o,
|
|
242
|
-
i18nKey: p,
|
|
243
|
-
context: s,
|
|
244
|
-
tOptions: i = {},
|
|
245
|
-
values: a,
|
|
246
|
-
defaults: f,
|
|
247
|
-
components: c,
|
|
248
|
-
ns: g,
|
|
249
|
-
i18n: E,
|
|
250
|
-
t: j,
|
|
251
|
-
shouldUnescape: b,
|
|
252
|
-
...x
|
|
253
|
-
} = e;
|
|
254
|
-
const h = E || B();
|
|
255
|
-
if (!h)
|
|
256
|
-
return Z("You will need to pass in an i18next instance by using i18nextReactModule"), t;
|
|
257
|
-
const m = j || h.t.bind(h) || ((C) => C);
|
|
258
|
-
s && (i.context = s);
|
|
259
|
-
const u = {
|
|
260
|
-
...ee(),
|
|
261
|
-
...h.options && h.options.react
|
|
262
|
-
};
|
|
263
|
-
let l = g || m.ns || h.options && h.options.defaultNS;
|
|
264
|
-
l = typeof l == "string" ? [l] : l || ["translation"];
|
|
265
|
-
const v = z(t, u), O = f || v || u.transEmptyNodeValue || p, {
|
|
266
|
-
hashTransKey: y
|
|
267
|
-
} = u, r = p || (y ? y(v || O) : v || O);
|
|
268
|
-
h.options && h.options.interpolation && h.options.interpolation.defaultVariables && (a = a && Object.keys(a).length > 0 ? {
|
|
269
|
-
...a,
|
|
270
|
-
...h.options.interpolation.defaultVariables
|
|
271
|
-
} : {
|
|
272
|
-
...h.options.interpolation.defaultVariables
|
|
273
|
-
});
|
|
274
|
-
const k = a ? i.interpolation : {
|
|
275
|
-
interpolation: {
|
|
276
|
-
...i.interpolation,
|
|
277
|
-
prefix: "#$?",
|
|
278
|
-
suffix: "?$#"
|
|
279
|
-
}
|
|
280
|
-
}, A = {
|
|
281
|
-
...i,
|
|
282
|
-
count: n,
|
|
283
|
-
...a,
|
|
284
|
-
...k,
|
|
285
|
-
defaultValue: O,
|
|
286
|
-
ns: l
|
|
287
|
-
}, w = r ? m(r, A) : O;
|
|
288
|
-
c && Object.keys(c).forEach((C) => {
|
|
289
|
-
const P = c[C];
|
|
290
|
-
if (typeof P.type == "function" || !P.props || !P.props.children || w.indexOf(`${C}/>`) < 0 && w.indexOf(`${C} />`) < 0) return;
|
|
291
|
-
function R() {
|
|
292
|
-
return T(_, null, P);
|
|
293
|
-
}
|
|
294
|
-
c[C] = T(R);
|
|
295
|
-
});
|
|
296
|
-
const d = fe(c || t, w, h, u, A, b), N = o !== void 0 ? o : u.defaultTransParent;
|
|
297
|
-
return N ? T(N, x, d) : d;
|
|
298
|
-
}
|
|
299
|
-
function he(e) {
|
|
300
|
-
let {
|
|
301
|
-
children: t,
|
|
302
|
-
count: n,
|
|
303
|
-
parent: o,
|
|
304
|
-
i18nKey: p,
|
|
305
|
-
context: s,
|
|
306
|
-
tOptions: i = {},
|
|
307
|
-
values: a,
|
|
308
|
-
defaults: f,
|
|
309
|
-
components: c,
|
|
310
|
-
ns: g,
|
|
311
|
-
i18n: E,
|
|
312
|
-
t: j,
|
|
313
|
-
shouldUnescape: b,
|
|
314
|
-
...x
|
|
315
|
-
} = e;
|
|
316
|
-
const {
|
|
317
|
-
i18n: h,
|
|
318
|
-
defaultNS: m
|
|
319
|
-
} = X(M) || {}, u = E || h || B(), l = j || u && u.t.bind(u);
|
|
320
|
-
return me({
|
|
321
|
-
children: t,
|
|
322
|
-
count: n,
|
|
323
|
-
parent: o,
|
|
324
|
-
i18nKey: p,
|
|
325
|
-
context: s,
|
|
326
|
-
tOptions: i,
|
|
327
|
-
values: a,
|
|
328
|
-
defaults: f,
|
|
329
|
-
components: c,
|
|
330
|
-
ns: g || l && l.ns || m || u && u.options && u.options.defaultNS,
|
|
331
|
-
i18n: u,
|
|
332
|
-
t: j,
|
|
333
|
-
shouldUnescape: b,
|
|
334
|
-
...x
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
function ye(e) {
|
|
338
|
-
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
339
|
-
return function(o) {
|
|
340
|
-
function p(i) {
|
|
341
|
-
let {
|
|
342
|
-
forwardedRef: a,
|
|
343
|
-
...f
|
|
344
|
-
} = i;
|
|
345
|
-
const [c, g, E] = Q(e, {
|
|
346
|
-
...f,
|
|
347
|
-
keyPrefix: t.keyPrefix
|
|
348
|
-
}), j = {
|
|
349
|
-
...f,
|
|
350
|
-
t: c,
|
|
351
|
-
i18n: g,
|
|
352
|
-
tReady: E
|
|
353
|
-
};
|
|
354
|
-
return t.withRef && a ? j.ref = a : !t.withRef && a && (j.forwardedRef = a), T(o, j);
|
|
355
|
-
}
|
|
356
|
-
p.displayName = `withI18nextTranslation(${G(o)})`, p.WrappedComponent = o;
|
|
357
|
-
const s = (i, a) => T(p, Object.assign({}, i, {
|
|
358
|
-
forwardedRef: a
|
|
359
|
-
}));
|
|
360
|
-
return t.withRef ? Y(s) : p;
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
function de({
|
|
364
|
-
i18n: e,
|
|
365
|
-
i18n_default_text: t,
|
|
366
|
-
values: n,
|
|
367
|
-
components: o,
|
|
368
|
-
options: p,
|
|
369
|
-
shouldUnescape: s
|
|
370
|
-
}) {
|
|
371
|
-
return /* @__PURE__ */ q.jsx(
|
|
372
|
-
he,
|
|
373
|
-
{
|
|
374
|
-
defaults: t,
|
|
375
|
-
i18n: e,
|
|
376
|
-
values: n,
|
|
377
|
-
components: o,
|
|
378
|
-
tOptions: p,
|
|
379
|
-
shouldUnescape: s
|
|
380
|
-
}
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
const $e = ye()(de);
|
|
384
|
-
export {
|
|
385
|
-
$e as default
|
|
386
|
-
};
|
|
1
|
+
import { t as e } from "../jsx-runtime-22qKqdB2.js";
|
|
2
|
+
import { Trans as t, withTranslation as n } from "react-i18next";
|
|
3
|
+
import "react";
|
|
4
|
+
//#region src/components/localize.tsx
|
|
5
|
+
var r = e();
|
|
6
|
+
function i({ i18n: e, i18n_default_text: n, values: i, components: a, options: o, shouldUnescape: s }) {
|
|
7
|
+
return /* @__PURE__ */ (0, r.jsx)(t, {
|
|
8
|
+
defaults: n,
|
|
9
|
+
i18n: e,
|
|
10
|
+
values: i,
|
|
11
|
+
components: a,
|
|
12
|
+
tOptions: o,
|
|
13
|
+
shouldUnescape: s
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
var a = n()(i);
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as default };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../utils/localize.js";
|
|
3
|
+
import { TranslationContext as t } from "../provider/translation-provider.js";
|
|
4
|
+
import "../provider/index.js";
|
|
5
|
+
import { useTranslation as n } from "react-i18next";
|
|
6
|
+
import { useContext as r } from "react";
|
|
7
|
+
//#region src/hooks/use-translations.ts
|
|
8
|
+
var i = e();
|
|
9
|
+
function a() {
|
|
10
|
+
let e = r(t), { ready: a, t: o, i18n: s } = n(), c = (e, t = {}) => o((0, i.str)(e).toString(), {
|
|
11
|
+
defaultValue: e,
|
|
12
|
+
...t
|
|
13
|
+
});
|
|
14
|
+
if (!e) throw Error("useTranslation has to be used within <TranslationContext.Provider>");
|
|
15
|
+
return {
|
|
16
|
+
ready: a,
|
|
17
|
+
localize: c,
|
|
18
|
+
instance: s,
|
|
19
|
+
switchLanguage: e.switchLanguage,
|
|
20
|
+
currentLang: e.currentLang
|
|
21
|
+
};
|
|
18
22
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as default };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
n as getAllowedLanguages,
|
|
11
|
-
i as getInitialLanguage,
|
|
12
|
-
o as initializeI18n,
|
|
13
|
-
f as loadIncontextTranslation,
|
|
14
|
-
r as localize,
|
|
15
|
-
x as useTranslations
|
|
16
|
-
};
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./utils-CvIwp1ax.js";
|
|
2
|
+
import i from "./utils/localize.js";
|
|
3
|
+
import a from "./components/localize.js";
|
|
4
|
+
import "./components/index.js";
|
|
5
|
+
import o from "./provider/translation-provider.js";
|
|
6
|
+
import "./provider/index.js";
|
|
7
|
+
import s from "./hooks/use-translations.js";
|
|
8
|
+
import "./hooks/index.js";
|
|
9
|
+
export { a as Localize, o as TranslationProvider, r as getAllowedLanguages, t as getInitialLanguage, e as initializeI18n, n as loadIncontextTranslation, i as localize, s as useTranslations };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { r as e, t } from "./chunk-CzZxQCTN.js";
|
|
2
|
+
//#region node_modules/react/cjs/react-jsx-runtime.production.js
|
|
3
|
+
var n = /* @__PURE__ */ t(((e) => {
|
|
4
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
5
|
+
function r(e, n, r) {
|
|
6
|
+
var i = null;
|
|
7
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
8
|
+
else r = n;
|
|
9
|
+
return n = r.ref, {
|
|
10
|
+
$$typeof: t,
|
|
11
|
+
type: e,
|
|
12
|
+
key: i,
|
|
13
|
+
ref: n === void 0 ? null : n,
|
|
14
|
+
props: r
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
18
|
+
})), r = /* @__PURE__ */ t(((t) => {
|
|
19
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
20
|
+
function n(e) {
|
|
21
|
+
if (e == null) return null;
|
|
22
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
23
|
+
if (typeof e == "string") return e;
|
|
24
|
+
switch (e) {
|
|
25
|
+
case v: return "Fragment";
|
|
26
|
+
case b: return "Profiler";
|
|
27
|
+
case y: return "StrictMode";
|
|
28
|
+
case w: return "Suspense";
|
|
29
|
+
case T: return "SuspenseList";
|
|
30
|
+
case O: return "Activity";
|
|
31
|
+
}
|
|
32
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
33
|
+
case _: return "Portal";
|
|
34
|
+
case S: return e.displayName || "Context";
|
|
35
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
36
|
+
case C:
|
|
37
|
+
var t = e.render;
|
|
38
|
+
return e = e.displayName, e ||= (e = t.displayName || t.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
39
|
+
case E: return t = e.displayName || null, t === null ? n(e.type) || "Memo" : t;
|
|
40
|
+
case D:
|
|
41
|
+
t = e._payload, e = e._init;
|
|
42
|
+
try {
|
|
43
|
+
return n(e(t));
|
|
44
|
+
} catch {}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function r(e) {
|
|
49
|
+
return "" + e;
|
|
50
|
+
}
|
|
51
|
+
function i(e) {
|
|
52
|
+
try {
|
|
53
|
+
r(e);
|
|
54
|
+
var t = !1;
|
|
55
|
+
} catch {
|
|
56
|
+
t = !0;
|
|
57
|
+
}
|
|
58
|
+
if (t) {
|
|
59
|
+
t = console;
|
|
60
|
+
var n = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
61
|
+
return n.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), r(e);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function a(e) {
|
|
65
|
+
if (e === v) return "<>";
|
|
66
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
67
|
+
try {
|
|
68
|
+
var t = n(e);
|
|
69
|
+
return t ? "<" + t + ">" : "<...>";
|
|
70
|
+
} catch {
|
|
71
|
+
return "<...>";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function o() {
|
|
75
|
+
var e = A.A;
|
|
76
|
+
return e === null ? null : e.getOwner();
|
|
77
|
+
}
|
|
78
|
+
function s() {
|
|
79
|
+
return Error("react-stack-top-frame");
|
|
80
|
+
}
|
|
81
|
+
function c(e) {
|
|
82
|
+
if (j.call(e, "key")) {
|
|
83
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
84
|
+
if (t && t.isReactWarning) return !1;
|
|
85
|
+
}
|
|
86
|
+
return e.key !== void 0;
|
|
87
|
+
}
|
|
88
|
+
function l(e, t) {
|
|
89
|
+
function n() {
|
|
90
|
+
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
91
|
+
}
|
|
92
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
93
|
+
get: n,
|
|
94
|
+
configurable: !0
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function u() {
|
|
98
|
+
var e = n(this.type);
|
|
99
|
+
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
100
|
+
}
|
|
101
|
+
function d(e, t, n, r, i, a) {
|
|
102
|
+
var o = n.ref;
|
|
103
|
+
return e = {
|
|
104
|
+
$$typeof: g,
|
|
105
|
+
type: e,
|
|
106
|
+
key: t,
|
|
107
|
+
props: n,
|
|
108
|
+
_owner: r
|
|
109
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
110
|
+
enumerable: !1,
|
|
111
|
+
value: null
|
|
112
|
+
}) : Object.defineProperty(e, "ref", {
|
|
113
|
+
enumerable: !1,
|
|
114
|
+
get: u
|
|
115
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
116
|
+
configurable: !1,
|
|
117
|
+
enumerable: !1,
|
|
118
|
+
writable: !0,
|
|
119
|
+
value: 0
|
|
120
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
121
|
+
configurable: !1,
|
|
122
|
+
enumerable: !1,
|
|
123
|
+
writable: !0,
|
|
124
|
+
value: null
|
|
125
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
126
|
+
configurable: !1,
|
|
127
|
+
enumerable: !1,
|
|
128
|
+
writable: !0,
|
|
129
|
+
value: i
|
|
130
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
131
|
+
configurable: !1,
|
|
132
|
+
enumerable: !1,
|
|
133
|
+
writable: !0,
|
|
134
|
+
value: a
|
|
135
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
136
|
+
}
|
|
137
|
+
function f(e, t, r, a, s, u) {
|
|
138
|
+
var f = t.children;
|
|
139
|
+
if (f !== void 0) if (a) if (M(f)) {
|
|
140
|
+
for (a = 0; a < f.length; a++) p(f[a]);
|
|
141
|
+
Object.freeze && Object.freeze(f);
|
|
142
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
143
|
+
else p(f);
|
|
144
|
+
if (j.call(t, "key")) {
|
|
145
|
+
f = n(e);
|
|
146
|
+
var m = Object.keys(t).filter(function(e) {
|
|
147
|
+
return e !== "key";
|
|
148
|
+
});
|
|
149
|
+
a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), R[f + a] = !0);
|
|
150
|
+
}
|
|
151
|
+
if (f = null, r !== void 0 && (i(r), f = "" + r), c(t) && (i(t.key), f = "" + t.key), "key" in t) for (var h in r = {}, t) h !== "key" && (r[h] = t[h]);
|
|
152
|
+
else r = t;
|
|
153
|
+
return f && l(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, r, o(), s, u);
|
|
154
|
+
}
|
|
155
|
+
function p(e) {
|
|
156
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
157
|
+
}
|
|
158
|
+
function m(e) {
|
|
159
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
160
|
+
}
|
|
161
|
+
var h = e("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
162
|
+
return null;
|
|
163
|
+
};
|
|
164
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
165
|
+
return e();
|
|
166
|
+
} };
|
|
167
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(a(s)), R = {};
|
|
168
|
+
t.Fragment = v, t.jsx = function(e, t, n) {
|
|
169
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
170
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
171
|
+
}, t.jsxs = function(e, t, n) {
|
|
172
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
173
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
174
|
+
};
|
|
175
|
+
})();
|
|
176
|
+
})), i = /* @__PURE__ */ t(((e, t) => {
|
|
177
|
+
process.env.NODE_ENV === "production" ? t.exports = n() : t.exports = r();
|
|
178
|
+
}));
|
|
179
|
+
//#endregion
|
|
180
|
+
export { i as t };
|