@deriv-com/translations 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-DeC0fbbY.js +23 -0
- package/dist/components/index.js +2 -4
- package/dist/components/localize.js +2 -386
- package/dist/hooks/index.js +2 -4
- package/dist/hooks/use-translations.js +22 -20
- package/dist/i18next-DzZwHOzH.js +1202 -0
- package/dist/index.js +9 -16
- package/dist/initReactI18next-AIGy7ACI.js +52 -0
- package/dist/jsx-runtime-BJITdUlL.js +193 -0
- package/dist/localize-CZ6EZTCG.js +366 -0
- package/dist/provider/index.js +2 -5
- package/dist/provider/translation-provider.js +2 -47
- 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/translation-provider-DouO5SpQ.js +34 -0
- package/dist/useTranslation-Ws-GUPE_.js +221 -0
- 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-17GMfKvo.js +50 -0
- package/package.json +28 -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/{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}/__tests__/lang-utils.spec.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
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 { t as e } from "./localize-CZ6EZTCG.js";
|
|
2
|
+
import { n as t } from "./translation-provider-DouO5SpQ.js";
|
|
3
|
+
import { i as n, n as r, r as i, t as a } from "./utils-17GMfKvo.js";
|
|
4
|
+
import o from "./utils/localize.js";
|
|
5
|
+
import "./components/index.js";
|
|
6
|
+
import "./provider/index.js";
|
|
7
|
+
import s from "./hooks/use-translations.js";
|
|
8
|
+
import "./hooks/index.js";
|
|
9
|
+
export { e as Localize, t as TranslationProvider, a as getAllowedLanguages, r as getInitialLanguage, n as initializeI18n, i as loadIncontextTranslation, o as localize, s as useTranslations };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region node_modules/react-i18next/dist/es/unescape.js
|
|
2
|
+
var e = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, t = {
|
|
3
|
+
"&": "&",
|
|
4
|
+
"&": "&",
|
|
5
|
+
"<": "<",
|
|
6
|
+
"<": "<",
|
|
7
|
+
">": ">",
|
|
8
|
+
">": ">",
|
|
9
|
+
"'": "'",
|
|
10
|
+
"'": "'",
|
|
11
|
+
""": "\"",
|
|
12
|
+
""": "\"",
|
|
13
|
+
" ": " ",
|
|
14
|
+
" ": " ",
|
|
15
|
+
"©": "©",
|
|
16
|
+
"©": "©",
|
|
17
|
+
"®": "®",
|
|
18
|
+
"®": "®",
|
|
19
|
+
"…": "…",
|
|
20
|
+
"…": "…",
|
|
21
|
+
"/": "/",
|
|
22
|
+
"/": "/"
|
|
23
|
+
}, n = (e) => t[e], r = (t) => t.replace(e, n), i = {
|
|
24
|
+
bindI18n: "languageChanged",
|
|
25
|
+
bindI18nStore: "",
|
|
26
|
+
transEmptyNodeValue: "",
|
|
27
|
+
transSupportBasicHtmlNodes: !0,
|
|
28
|
+
transWrapTextNodes: "",
|
|
29
|
+
transKeepBasicHtmlNodesFor: [
|
|
30
|
+
"br",
|
|
31
|
+
"strong",
|
|
32
|
+
"i",
|
|
33
|
+
"p"
|
|
34
|
+
],
|
|
35
|
+
useSuspense: !0,
|
|
36
|
+
unescape: r,
|
|
37
|
+
transDefaultProps: void 0
|
|
38
|
+
}, a = (e = {}) => {
|
|
39
|
+
i = {
|
|
40
|
+
...i,
|
|
41
|
+
...e
|
|
42
|
+
};
|
|
43
|
+
}, o = () => i, s, c = (e) => {
|
|
44
|
+
s = e;
|
|
45
|
+
}, l = () => s, u = {
|
|
46
|
+
type: "3rdParty",
|
|
47
|
+
init(e) {
|
|
48
|
+
a(e.options.react), c(e);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { r as i, l as n, o as r, u as t };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { r as e, t } from "./chunk-DeC0fbbY.js";
|
|
2
|
+
import { createContext as n } from "react";
|
|
3
|
+
//#region node_modules/react-i18next/dist/es/context.js
|
|
4
|
+
var r = n(), i = class {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.usedNamespaces = {};
|
|
7
|
+
}
|
|
8
|
+
addUsedNamespaces(e) {
|
|
9
|
+
e.forEach((e) => {
|
|
10
|
+
this.usedNamespaces[e] || (this.usedNamespaces[e] = !0);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
getUsedNamespaces() {
|
|
14
|
+
return Object.keys(this.usedNamespaces);
|
|
15
|
+
}
|
|
16
|
+
}, a = /* @__PURE__ */ t(((e) => {
|
|
17
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
18
|
+
function r(e, n, r) {
|
|
19
|
+
var i = null;
|
|
20
|
+
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]);
|
|
21
|
+
else r = n;
|
|
22
|
+
return n = r.ref, {
|
|
23
|
+
$$typeof: t,
|
|
24
|
+
type: e,
|
|
25
|
+
key: i,
|
|
26
|
+
ref: n === void 0 ? null : n,
|
|
27
|
+
props: r
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
31
|
+
})), o = /* @__PURE__ */ t(((t) => {
|
|
32
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
33
|
+
function n(e) {
|
|
34
|
+
if (e == null) return null;
|
|
35
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
36
|
+
if (typeof e == "string") return e;
|
|
37
|
+
switch (e) {
|
|
38
|
+
case v: return "Fragment";
|
|
39
|
+
case b: return "Profiler";
|
|
40
|
+
case y: return "StrictMode";
|
|
41
|
+
case w: return "Suspense";
|
|
42
|
+
case T: return "SuspenseList";
|
|
43
|
+
case O: return "Activity";
|
|
44
|
+
}
|
|
45
|
+
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) {
|
|
46
|
+
case _: return "Portal";
|
|
47
|
+
case S: return e.displayName || "Context";
|
|
48
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
49
|
+
case C:
|
|
50
|
+
var t = e.render;
|
|
51
|
+
return e = e.displayName, e ||= (e = t.displayName || t.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
52
|
+
case E: return t = e.displayName || null, t === null ? n(e.type) || "Memo" : t;
|
|
53
|
+
case D:
|
|
54
|
+
t = e._payload, e = e._init;
|
|
55
|
+
try {
|
|
56
|
+
return n(e(t));
|
|
57
|
+
} catch {}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
function r(e) {
|
|
62
|
+
return "" + e;
|
|
63
|
+
}
|
|
64
|
+
function i(e) {
|
|
65
|
+
try {
|
|
66
|
+
r(e);
|
|
67
|
+
var t = !1;
|
|
68
|
+
} catch {
|
|
69
|
+
t = !0;
|
|
70
|
+
}
|
|
71
|
+
if (t) {
|
|
72
|
+
t = console;
|
|
73
|
+
var n = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
74
|
+
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);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function a(e) {
|
|
78
|
+
if (e === v) return "<>";
|
|
79
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
80
|
+
try {
|
|
81
|
+
var t = n(e);
|
|
82
|
+
return t ? "<" + t + ">" : "<...>";
|
|
83
|
+
} catch {
|
|
84
|
+
return "<...>";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function o() {
|
|
88
|
+
var e = A.A;
|
|
89
|
+
return e === null ? null : e.getOwner();
|
|
90
|
+
}
|
|
91
|
+
function s() {
|
|
92
|
+
return Error("react-stack-top-frame");
|
|
93
|
+
}
|
|
94
|
+
function c(e) {
|
|
95
|
+
if (j.call(e, "key")) {
|
|
96
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
97
|
+
if (t && t.isReactWarning) return !1;
|
|
98
|
+
}
|
|
99
|
+
return e.key !== void 0;
|
|
100
|
+
}
|
|
101
|
+
function l(e, t) {
|
|
102
|
+
function n() {
|
|
103
|
+
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));
|
|
104
|
+
}
|
|
105
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
106
|
+
get: n,
|
|
107
|
+
configurable: !0
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function u() {
|
|
111
|
+
var e = n(this.type);
|
|
112
|
+
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;
|
|
113
|
+
}
|
|
114
|
+
function d(e, t, n, r, i, a) {
|
|
115
|
+
var o = n.ref;
|
|
116
|
+
return e = {
|
|
117
|
+
$$typeof: g,
|
|
118
|
+
type: e,
|
|
119
|
+
key: t,
|
|
120
|
+
props: n,
|
|
121
|
+
_owner: r
|
|
122
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
123
|
+
enumerable: !1,
|
|
124
|
+
value: null
|
|
125
|
+
}) : Object.defineProperty(e, "ref", {
|
|
126
|
+
enumerable: !1,
|
|
127
|
+
get: u
|
|
128
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
129
|
+
configurable: !1,
|
|
130
|
+
enumerable: !1,
|
|
131
|
+
writable: !0,
|
|
132
|
+
value: 0
|
|
133
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
134
|
+
configurable: !1,
|
|
135
|
+
enumerable: !1,
|
|
136
|
+
writable: !0,
|
|
137
|
+
value: null
|
|
138
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
139
|
+
configurable: !1,
|
|
140
|
+
enumerable: !1,
|
|
141
|
+
writable: !0,
|
|
142
|
+
value: i
|
|
143
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
144
|
+
configurable: !1,
|
|
145
|
+
enumerable: !1,
|
|
146
|
+
writable: !0,
|
|
147
|
+
value: a
|
|
148
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
149
|
+
}
|
|
150
|
+
function f(e, t, r, a, s, u) {
|
|
151
|
+
var f = t.children;
|
|
152
|
+
if (f !== void 0) if (a) if (M(f)) {
|
|
153
|
+
for (a = 0; a < f.length; a++) p(f[a]);
|
|
154
|
+
Object.freeze && Object.freeze(f);
|
|
155
|
+
} 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.");
|
|
156
|
+
else p(f);
|
|
157
|
+
if (j.call(t, "key")) {
|
|
158
|
+
f = n(e);
|
|
159
|
+
var m = Object.keys(t).filter(function(e) {
|
|
160
|
+
return e !== "key";
|
|
161
|
+
});
|
|
162
|
+
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);
|
|
163
|
+
}
|
|
164
|
+
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]);
|
|
165
|
+
else r = t;
|
|
166
|
+
return f && l(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, r, o(), s, u);
|
|
167
|
+
}
|
|
168
|
+
function p(e) {
|
|
169
|
+
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));
|
|
170
|
+
}
|
|
171
|
+
function m(e) {
|
|
172
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
173
|
+
}
|
|
174
|
+
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() {
|
|
175
|
+
return null;
|
|
176
|
+
};
|
|
177
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
178
|
+
return e();
|
|
179
|
+
} };
|
|
180
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(a(s)), R = {};
|
|
181
|
+
t.Fragment = v, t.jsx = function(e, t, n) {
|
|
182
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
183
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
184
|
+
}, t.jsxs = function(e, t, n) {
|
|
185
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
186
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
187
|
+
};
|
|
188
|
+
})();
|
|
189
|
+
})), s = /* @__PURE__ */ t(((e, t) => {
|
|
190
|
+
process.env.NODE_ENV === "production" ? t.exports = a() : t.exports = o();
|
|
191
|
+
}));
|
|
192
|
+
//#endregion
|
|
193
|
+
export { r as n, i as r, s as t };
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { i as e, t } from "./chunk-DeC0fbbY.js";
|
|
2
|
+
import { n } from "./i18next-DzZwHOzH.js";
|
|
3
|
+
import { a as r, i, n as a, o, r as s, t as c } from "./useTranslation-Ws-GUPE_.js";
|
|
4
|
+
import { i as l, n as u, r as d } from "./initReactI18next-AIGy7ACI.js";
|
|
5
|
+
import { n as f, t as p } from "./jsx-runtime-BJITdUlL.js";
|
|
6
|
+
import { Children as m, Fragment as h, cloneElement as g, createElement as _, forwardRef as v, isValidElement as y, useContext as b } from "react";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
|
|
9
|
+
var x = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
|
|
10
|
+
t.exports = {
|
|
11
|
+
area: !0,
|
|
12
|
+
base: !0,
|
|
13
|
+
br: !0,
|
|
14
|
+
col: !0,
|
|
15
|
+
embed: !0,
|
|
16
|
+
hr: !0,
|
|
17
|
+
img: !0,
|
|
18
|
+
input: !0,
|
|
19
|
+
link: !0,
|
|
20
|
+
meta: !0,
|
|
21
|
+
param: !0,
|
|
22
|
+
source: !0,
|
|
23
|
+
track: !0,
|
|
24
|
+
wbr: !0
|
|
25
|
+
};
|
|
26
|
+
})))()), S = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
|
|
27
|
+
function C(e) {
|
|
28
|
+
var t = {
|
|
29
|
+
type: "tag",
|
|
30
|
+
name: "",
|
|
31
|
+
voidElement: !1,
|
|
32
|
+
attrs: {},
|
|
33
|
+
children: []
|
|
34
|
+
}, n = e.match(/<\/?([^\s]+?)[/\s>]/);
|
|
35
|
+
if (n && (t.name = n[1], (x.default[n[1]] || e.charAt(e.length - 2) === "/") && (t.voidElement = !0), t.name.startsWith("!--"))) {
|
|
36
|
+
var r = e.indexOf("-->");
|
|
37
|
+
return {
|
|
38
|
+
type: "comment",
|
|
39
|
+
comment: r === -1 ? "" : e.slice(4, r)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
for (var i = new RegExp(S), a = null; (a = i.exec(e)) !== null;) if (a[0].trim()) if (a[1]) {
|
|
43
|
+
var o = a[1].trim(), s = [o, ""];
|
|
44
|
+
o.indexOf("=") > -1 && (s = o.split("=")), t.attrs[s[0]] = s[1], i.lastIndex--;
|
|
45
|
+
} else a[2] && (t.attrs[a[2]] = a[3].trim().substring(1, a[3].length - 1));
|
|
46
|
+
return t;
|
|
47
|
+
}
|
|
48
|
+
var w = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, T = /^\s*$/, E = Object.create(null);
|
|
49
|
+
function D(e, t) {
|
|
50
|
+
switch (t.type) {
|
|
51
|
+
case "text": return e + t.content;
|
|
52
|
+
case "tag": return e += "<" + t.name + (t.attrs ? function(e) {
|
|
53
|
+
var t = [];
|
|
54
|
+
for (var n in e) t.push(n + "=\"" + e[n] + "\"");
|
|
55
|
+
return t.length ? " " + t.join(" ") : "";
|
|
56
|
+
}(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(D, "") + "</" + t.name + ">";
|
|
57
|
+
case "comment": return e + "<!--" + t.comment + "-->";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
var O = {
|
|
61
|
+
parse: function(e, t) {
|
|
62
|
+
t ||= {}, t.components ||= E;
|
|
63
|
+
var n, r = [], i = [], a = -1, o = !1;
|
|
64
|
+
if (e.indexOf("<") !== 0) {
|
|
65
|
+
var s = e.indexOf("<");
|
|
66
|
+
r.push({
|
|
67
|
+
type: "text",
|
|
68
|
+
content: s === -1 ? e : e.substring(0, s)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return e.replace(w, function(s, c) {
|
|
72
|
+
if (o) {
|
|
73
|
+
if (s !== "</" + n.name + ">") return;
|
|
74
|
+
o = !1;
|
|
75
|
+
}
|
|
76
|
+
var l, u = s.charAt(1) !== "/", d = s.startsWith("<!--"), f = c + s.length, p = e.charAt(f);
|
|
77
|
+
if (d) {
|
|
78
|
+
var m = C(s);
|
|
79
|
+
return a < 0 ? (r.push(m), r) : ((l = i[a]).children.push(m), r);
|
|
80
|
+
}
|
|
81
|
+
if (u && (a++, (n = C(s)).type === "tag" && t.components[n.name] && (n.type = "component", o = !0), n.voidElement || o || !p || p === "<" || n.children.push({
|
|
82
|
+
type: "text",
|
|
83
|
+
content: e.slice(f, e.indexOf("<", f))
|
|
84
|
+
}), a === 0 && r.push(n), (l = i[a - 1]) && l.children.push(n), i[a] = n), (!u || n.voidElement) && (a > -1 && (n.voidElement || n.name === s.slice(2, -1)) && (a--, n = a === -1 ? r : i[a]), !o && p !== "<" && p)) {
|
|
85
|
+
l = a === -1 ? r : i[a].children;
|
|
86
|
+
var h = e.indexOf("<", f), g = e.slice(f, h === -1 ? void 0 : h);
|
|
87
|
+
T.test(g) && (g = " "), (h > -1 && a + l.length >= 0 || g !== " ") && l.push({
|
|
88
|
+
type: "text",
|
|
89
|
+
content: g
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}), r;
|
|
93
|
+
},
|
|
94
|
+
stringify: function(e) {
|
|
95
|
+
return e.reduce(function(e, t) {
|
|
96
|
+
return e + D("", t);
|
|
97
|
+
}, "");
|
|
98
|
+
}
|
|
99
|
+
}, k = (e, t) => {
|
|
100
|
+
if (!e) return !1;
|
|
101
|
+
let n = e.props?.children ?? e.children;
|
|
102
|
+
return t ? n.length > 0 : !!n;
|
|
103
|
+
}, A = (e) => {
|
|
104
|
+
if (!e) return [];
|
|
105
|
+
let t = e.props?.children ?? e.children;
|
|
106
|
+
return e.props?.i18nIsDynamicList ? M(t) : t;
|
|
107
|
+
}, j = (e) => Array.isArray(e) && e.every(y), M = (e) => Array.isArray(e) ? e : [e], N = (e, t) => {
|
|
108
|
+
let n = { ...t };
|
|
109
|
+
return n.props = {
|
|
110
|
+
...t.props,
|
|
111
|
+
...e.props
|
|
112
|
+
}, n;
|
|
113
|
+
}, P = (e) => {
|
|
114
|
+
let t = {};
|
|
115
|
+
if (!e) return t;
|
|
116
|
+
let n = (e) => {
|
|
117
|
+
M(e).forEach((e) => {
|
|
118
|
+
i(e) || (k(e) ? n(A(e)) : s(e) && !y(e) && Object.assign(t, e));
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
return n(e), t;
|
|
122
|
+
}, F = (e, t, n, a) => {
|
|
123
|
+
if (!e) return "";
|
|
124
|
+
let o = "", c = M(e), l = t?.transSupportBasicHtmlNodes ? t.transKeepBasicHtmlNodesFor ?? [] : [];
|
|
125
|
+
return c.forEach((e, c) => {
|
|
126
|
+
if (i(e)) {
|
|
127
|
+
o += `${e}`;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (y(e)) {
|
|
131
|
+
let { props: r, type: s } = e, u = Object.keys(r).length, d = l.indexOf(s) > -1, f = r.children;
|
|
132
|
+
if (!f && d && !u) {
|
|
133
|
+
o += `<${s}/>`;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (!f && (!d || u) || r.i18nIsDynamicList) {
|
|
137
|
+
o += `<${c}></${c}>`;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (d && u <= 1) {
|
|
141
|
+
let e = i(f) ? f : F(f, t, n, a);
|
|
142
|
+
o += `<${s}>${e}</${s}>`;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
let p = F(f, t, n, a);
|
|
146
|
+
o += `<${c}>${p}</${c}>`;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (e === null) {
|
|
150
|
+
r(n, "TRANS_NULL_VALUE", "Passed in a null value as child", { i18nKey: a });
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (s(e)) {
|
|
154
|
+
let { format: t, ...i } = e, s = Object.keys(i);
|
|
155
|
+
if (s.length === 1) {
|
|
156
|
+
let e = t ? `${s[0]}, ${t}` : s[0];
|
|
157
|
+
o += `{{${e}}}`;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
r(n, "TRANS_INVALID_OBJ", "Invalid child - Object should only have keys {{ value, format }} (format is optional).", {
|
|
161
|
+
i18nKey: a,
|
|
162
|
+
child: e
|
|
163
|
+
});
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
r(n, "TRANS_INVALID_VAR", "Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.", {
|
|
167
|
+
i18nKey: a,
|
|
168
|
+
child: e
|
|
169
|
+
});
|
|
170
|
+
}), o;
|
|
171
|
+
}, I = (e, t = [], n = {}) => {
|
|
172
|
+
if (!e) return e;
|
|
173
|
+
let r = Object.keys(n), i = [...t, ...r], a = "", o = 0;
|
|
174
|
+
for (; o < e.length;) if (e[o] === "<") {
|
|
175
|
+
let t = !1, n = e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);
|
|
176
|
+
if (n) {
|
|
177
|
+
let e = n[1];
|
|
178
|
+
(/^\d+$/.test(e) || i.includes(e)) && (t = !0, a += n[0], o += n[0].length);
|
|
179
|
+
}
|
|
180
|
+
if (!t) {
|
|
181
|
+
let n = e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);
|
|
182
|
+
if (n) {
|
|
183
|
+
let e = n[1];
|
|
184
|
+
(/^\d+$/.test(e) || i.includes(e)) && (t = !0, a += n[0], o += n[0].length);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
t || (a += "<", o += 1);
|
|
188
|
+
} else a += e[o], o += 1;
|
|
189
|
+
return a;
|
|
190
|
+
}, L = (e, t, n, r, a, o, c) => {
|
|
191
|
+
if (n === "") return [];
|
|
192
|
+
let u = a.transKeepBasicHtmlNodesFor || [], f = n && new RegExp(u.map((e) => `<${e}`).join("|")).test(n);
|
|
193
|
+
if (!e && !t && !f && !c) return [n];
|
|
194
|
+
let p = t ?? {}, h = (e) => {
|
|
195
|
+
M(e).forEach((e) => {
|
|
196
|
+
i(e) || (k(e) ? h(A(e)) : s(e) && !y(e) && Object.assign(p, e));
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
h(e);
|
|
200
|
+
let v = I(n, u, p), b = O.parse(`<0>${v}</0>`), x = {
|
|
201
|
+
...p,
|
|
202
|
+
...o
|
|
203
|
+
}, S = (e, t, n) => {
|
|
204
|
+
let r = A(e), i = w(r, t.children, n);
|
|
205
|
+
return j(r) && i.length === 0 || e.props?.i18nIsDynamicList ? r : i;
|
|
206
|
+
}, C = (e, t, n, r, i) => {
|
|
207
|
+
e.dummy ? (e.children = t, n.push(g(e, { key: r }, i ? void 0 : t))) : n.push(...m.map([e], (e) => {
|
|
208
|
+
let n = "data-i18n-is-dynamic-list", a = {
|
|
209
|
+
key: r,
|
|
210
|
+
[n]: void 0
|
|
211
|
+
};
|
|
212
|
+
return e && e.props && Object.keys(e.props).forEach((t) => {
|
|
213
|
+
t === "ref" || t === "children" || t === "i18nIsDynamicList" || t === n || (a[t] = e.props[t]);
|
|
214
|
+
}), g(e, a, i ? null : t);
|
|
215
|
+
}));
|
|
216
|
+
}, w = (e, n, o) => {
|
|
217
|
+
let p = M(e);
|
|
218
|
+
return M(n).reduce((e, n, m) => {
|
|
219
|
+
let h = n.children?.[0]?.content && r.services.interpolator.interpolate(n.children[0].content, x, r.language);
|
|
220
|
+
if (n.type === "tag") {
|
|
221
|
+
let d = p[parseInt(n.name, 10)];
|
|
222
|
+
!d && t && (d = t[n.name]), o.length === 1 && !d && (d = o[0][n.name]), d ||= {};
|
|
223
|
+
let g = { ...n.attrs };
|
|
224
|
+
c && Object.keys(g).forEach((e) => {
|
|
225
|
+
let t = g[e];
|
|
226
|
+
i(t) && (g[e] = l(t));
|
|
227
|
+
});
|
|
228
|
+
let v = Object.keys(g).length === 0 ? d : N({ props: g }, d), b = y(v), T = b && k(n, !0) && !n.voidElement, E = f && s(v) && v.dummy && !b, D = s(t) && Object.hasOwnProperty.call(t, n.name);
|
|
229
|
+
if (i(v)) {
|
|
230
|
+
let t = r.services.interpolator.interpolate(v, x, r.language);
|
|
231
|
+
e.push(t);
|
|
232
|
+
} else if (k(v) || T) C(v, S(v, n, o), e, m);
|
|
233
|
+
else if (E) C(v, w(p, n.children, o), e, m);
|
|
234
|
+
else if (Number.isNaN(parseFloat(n.name))) if (D) C(v, S(v, n, o), e, m, n.voidElement);
|
|
235
|
+
else if (a.transSupportBasicHtmlNodes && u.indexOf(n.name) > -1) if (n.voidElement) e.push(_(n.name, { key: `${n.name}-${m}` }));
|
|
236
|
+
else {
|
|
237
|
+
let t = w(p, n.children, o);
|
|
238
|
+
e.push(_(n.name, { key: `${n.name}-${m}` }, t));
|
|
239
|
+
}
|
|
240
|
+
else if (n.voidElement) e.push(`<${n.name} />`);
|
|
241
|
+
else {
|
|
242
|
+
let t = w(p, n.children, o);
|
|
243
|
+
e.push(`<${n.name}>${t}</${n.name}>`);
|
|
244
|
+
}
|
|
245
|
+
else if (s(v) && !b) {
|
|
246
|
+
let t = n.children[0] ? h : null;
|
|
247
|
+
t && e.push(t);
|
|
248
|
+
} else C(v, h, e, m, n.children.length !== 1 || !h);
|
|
249
|
+
} else if (n.type === "text") {
|
|
250
|
+
let t = a.transWrapTextNodes, i = typeof a.unescape == "function" ? a.unescape : d().unescape, o = c ? i(r.services.interpolator.interpolate(n.content, x, r.language)) : r.services.interpolator.interpolate(n.content, x, r.language);
|
|
251
|
+
t ? e.push(_(t, { key: `${n.name}-${m}` }, o)) : e.push(o);
|
|
252
|
+
}
|
|
253
|
+
return e;
|
|
254
|
+
}, []);
|
|
255
|
+
};
|
|
256
|
+
return A(w([{
|
|
257
|
+
dummy: !0,
|
|
258
|
+
children: e || []
|
|
259
|
+
}], b, M(e || []))[0]);
|
|
260
|
+
}, R = (e, t, n) => {
|
|
261
|
+
let r = e.key || t, i = g(e, { key: r });
|
|
262
|
+
if (!i.props || !i.props.children || n.indexOf(`${t}/>`) < 0 && n.indexOf(`${t} />`) < 0) return i;
|
|
263
|
+
function a() {
|
|
264
|
+
return _(h, null, i);
|
|
265
|
+
}
|
|
266
|
+
return _(a, { key: r });
|
|
267
|
+
}, z = (e, t) => e.map((e, n) => R(e, n, t)), B = (e, t) => {
|
|
268
|
+
let n = {};
|
|
269
|
+
return Object.keys(e).forEach((r) => {
|
|
270
|
+
Object.assign(n, { [r]: R(e[r], r, t) });
|
|
271
|
+
}), n;
|
|
272
|
+
}, V = (e, t, n, r) => e ? Array.isArray(e) ? z(e, t) : s(e) ? B(e, t) : (o(n, "TRANS_INVALID_COMPONENTS", "<Trans /> \"components\" prop expects an object or array", { i18nKey: r }), null) : null, H = (e) => !s(e) || Array.isArray(e) ? !1 : Object.keys(e).reduce((e, t) => e && Number.isNaN(Number.parseFloat(t)), !0);
|
|
273
|
+
function U({ children: e, count: t, parent: r, i18nKey: a, context: s, tOptions: c = {}, values: l, defaults: f, components: p, ns: m, i18n: h, t: g, shouldUnescape: v, ...y }) {
|
|
274
|
+
let b = h || u();
|
|
275
|
+
if (!b) return o(b, "NO_I18NEXT_INSTANCE", "Trans: You need to pass in an i18next instance using i18nextReactModule", { i18nKey: a }), e;
|
|
276
|
+
let x = g || b.t.bind(b) || ((e) => e), S = {
|
|
277
|
+
...d(),
|
|
278
|
+
...b.options?.react
|
|
279
|
+
}, C = m || x.ns || b.options?.defaultNS;
|
|
280
|
+
C = i(C) ? [C] : C || ["translation"];
|
|
281
|
+
let { transDefaultProps: w } = S, T = w?.tOptions ? {
|
|
282
|
+
...w.tOptions,
|
|
283
|
+
...c
|
|
284
|
+
} : c, E = v ?? w?.shouldUnescape, D = w?.values ? {
|
|
285
|
+
...w.values,
|
|
286
|
+
...l
|
|
287
|
+
} : l, O = w?.components ? {
|
|
288
|
+
...w.components,
|
|
289
|
+
...p
|
|
290
|
+
} : p, k = F(e, S, b, a), A = f || T?.defaultValue || k || S.transEmptyNodeValue || (typeof a == "function" ? n(a) : a), { hashTransKey: j } = S, M = a || (j ? j(k || A) : k || A);
|
|
291
|
+
l = b.options?.interpolation?.defaultVariables ? D && Object.keys(D).length > 0 ? {
|
|
292
|
+
...D,
|
|
293
|
+
...b.options.interpolation.defaultVariables
|
|
294
|
+
} : { ...b.options.interpolation.defaultVariables } : D;
|
|
295
|
+
let N = P(e);
|
|
296
|
+
N && typeof N.count == "number" && t === void 0 && (t = N.count);
|
|
297
|
+
let I = l || t !== void 0 && !b.options?.interpolation?.alwaysFormat || !e ? T.interpolation : { interpolation: {
|
|
298
|
+
...T.interpolation,
|
|
299
|
+
prefix: "#$?",
|
|
300
|
+
suffix: "?$#"
|
|
301
|
+
} }, R = {
|
|
302
|
+
...T,
|
|
303
|
+
context: s || T.context,
|
|
304
|
+
count: t,
|
|
305
|
+
...l,
|
|
306
|
+
...I,
|
|
307
|
+
defaultValue: A,
|
|
308
|
+
ns: C
|
|
309
|
+
}, z = M ? x(M, R) : A;
|
|
310
|
+
z === M && A && (z = A);
|
|
311
|
+
let B = V(O, z, b, a), U = B || e, W = null;
|
|
312
|
+
H(B) && (W = B, U = e);
|
|
313
|
+
let G = L(U, W, z, b, S, R, E), K = r ?? S.defaultTransParent;
|
|
314
|
+
return K ? _(K, y, G) : G;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region node_modules/react-i18next/dist/es/Trans.js
|
|
318
|
+
function W({ children: e, count: t, parent: n, i18nKey: r, context: i, tOptions: a = {}, values: o, defaults: s, components: c, ns: l, i18n: d, t: p, shouldUnescape: m, ...h }) {
|
|
319
|
+
let { i18n: g, defaultNS: _ } = b(f) || {}, v = d || g || u(), y = p || v?.t.bind(v);
|
|
320
|
+
return U({
|
|
321
|
+
children: e,
|
|
322
|
+
count: t,
|
|
323
|
+
parent: n,
|
|
324
|
+
i18nKey: r,
|
|
325
|
+
context: i,
|
|
326
|
+
tOptions: a,
|
|
327
|
+
values: o,
|
|
328
|
+
defaults: s,
|
|
329
|
+
components: c,
|
|
330
|
+
ns: l || y?.ns || _ || v?.options?.defaultNS,
|
|
331
|
+
i18n: v,
|
|
332
|
+
t: p,
|
|
333
|
+
shouldUnescape: m,
|
|
334
|
+
...h
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region node_modules/react-i18next/dist/es/withTranslation.js
|
|
339
|
+
var G = (e, t = {}) => function(n) {
|
|
340
|
+
function r({ forwardedRef: r, ...i }) {
|
|
341
|
+
let [a, o, s] = c(e, {
|
|
342
|
+
...i,
|
|
343
|
+
keyPrefix: t.keyPrefix
|
|
344
|
+
}), l = {
|
|
345
|
+
...i,
|
|
346
|
+
t: a,
|
|
347
|
+
i18n: o,
|
|
348
|
+
tReady: s
|
|
349
|
+
};
|
|
350
|
+
return t.withRef && r ? l.ref = r : !t.withRef && r && (l.forwardedRef = r), _(n, l);
|
|
351
|
+
}
|
|
352
|
+
return r.displayName = `withI18nextTranslation(${a(n)})`, r.WrappedComponent = n, t.withRef ? v((e, t) => _(r, Object.assign({}, e, { forwardedRef: t }))) : r;
|
|
353
|
+
}, K = p();
|
|
354
|
+
function q({ i18n: e, i18n_default_text: t, values: n, components: r, options: i, shouldUnescape: a }) {
|
|
355
|
+
return /* @__PURE__ */ (0, K.jsx)(W, {
|
|
356
|
+
defaults: t,
|
|
357
|
+
i18n: e,
|
|
358
|
+
values: n,
|
|
359
|
+
components: r,
|
|
360
|
+
tOptions: i,
|
|
361
|
+
shouldUnescape: a
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
var J = G()(q);
|
|
365
|
+
//#endregion
|
|
366
|
+
export { J as t };
|
package/dist/provider/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
r as TranslationContext,
|
|
4
|
-
t as TranslationProvider
|
|
5
|
-
};
|
|
1
|
+
import { n as e, t } from "../translation-provider-DouO5SpQ.js";
|
|
2
|
+
export { t as TranslationContext, e as TranslationProvider };
|