@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
|
@@ -1,47 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import "../crc32-BeCcwohL.js";
|
|
4
|
-
import { L } from "../constants-HKuDWVkt.js";
|
|
5
|
-
function p(t) {
|
|
6
|
-
let {
|
|
7
|
-
i18n: e,
|
|
8
|
-
defaultNS: o,
|
|
9
|
-
children: a
|
|
10
|
-
} = t;
|
|
11
|
-
const n = g(() => ({
|
|
12
|
-
i18n: e,
|
|
13
|
-
defaultNS: o
|
|
14
|
-
}), [e, o]);
|
|
15
|
-
return m(f.Provider, {
|
|
16
|
-
value: n
|
|
17
|
-
}, a);
|
|
18
|
-
}
|
|
19
|
-
const v = d(null);
|
|
20
|
-
function P({
|
|
21
|
-
defaultLang: t,
|
|
22
|
-
i18nInstance: e,
|
|
23
|
-
children: o
|
|
24
|
-
}) {
|
|
25
|
-
const [a, n] = i(t || ""), [u, l] = i(!1), c = (r) => {
|
|
26
|
-
e.changeLanguage(r), n(r), localStorage.setItem(L, JSON.stringify(r));
|
|
27
|
-
};
|
|
28
|
-
return x(() => {
|
|
29
|
-
if (e) {
|
|
30
|
-
const r = e.language || t || "";
|
|
31
|
-
n(r), l(!0);
|
|
32
|
-
}
|
|
33
|
-
}, [e, t]), !e || !u ? null : /* @__PURE__ */ s.jsx(p, { i18n: e, children: /* @__PURE__ */ s.jsx(
|
|
34
|
-
v.Provider,
|
|
35
|
-
{
|
|
36
|
-
value: {
|
|
37
|
-
currentLang: a,
|
|
38
|
-
switchLanguage: c
|
|
39
|
-
},
|
|
40
|
-
children: o
|
|
41
|
-
}
|
|
42
|
-
) });
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
v as TranslationContext,
|
|
46
|
-
P as default
|
|
47
|
-
};
|
|
1
|
+
import { n as e, t } from "../translation-provider-DouO5SpQ.js";
|
|
2
|
+
export { t as TranslationContext, e as default };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { i18n } from 'i18next';
|
|
2
|
+
import { default as React } from 'react';
|
|
2
3
|
type TLocalizeProps = {
|
|
3
4
|
i18n_default_text: string;
|
|
4
5
|
values?: object;
|
|
5
|
-
components?: JSX.Element[];
|
|
6
|
+
components?: React.JSX.Element[];
|
|
6
7
|
options?: Record<string, unknown>;
|
|
7
8
|
shouldUnescape?: boolean;
|
|
8
9
|
i18n?: i18n;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { localize, getInitialLanguage, loadIncontextTranslation, getAllowedLanguages, initializeI18n, } from '../utils/index';
|
|
2
|
+
export { Localize } from '../components/index';
|
|
3
|
+
export { useTranslations } from '../hooks/index';
|
|
4
|
+
export { TranslationProvider } from '../provider/index';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { constants } from '
|
|
1
|
+
import { constants } from '../../utils/index';
|
|
2
2
|
type LanguageCode = keyof typeof constants.ALL_LANGUAGES;
|
|
3
3
|
export declare const getInitialLanguage: () => any;
|
|
4
4
|
export declare const loadIncontextTranslation: (lang: LanguageCode) => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { n as e, t } from "./jsx-runtime-BJITdUlL.js";
|
|
2
|
+
import "./utils-17GMfKvo.js";
|
|
3
|
+
import { LANGUAGE_KEY as n } from "./utils/constants.js";
|
|
4
|
+
import { createContext as r, createElement as i, useEffect as a, useMemo as o, useState as s } from "react";
|
|
5
|
+
//#region node_modules/react-i18next/dist/es/I18nextProvider.js
|
|
6
|
+
function c({ i18n: t, defaultNS: n, children: r }) {
|
|
7
|
+
let a = o(() => ({
|
|
8
|
+
i18n: t,
|
|
9
|
+
defaultNS: n
|
|
10
|
+
}), [t, n]);
|
|
11
|
+
return i(e.Provider, { value: a }, r);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/provider/translation-provider.tsx
|
|
15
|
+
var l = t(), u = r(null);
|
|
16
|
+
function d({ defaultLang: e, i18nInstance: t, children: r }) {
|
|
17
|
+
let [i, o] = s(e || ""), [d, f] = s(!1);
|
|
18
|
+
return a(() => {
|
|
19
|
+
t && (o(t.language || e || ""), f(!0));
|
|
20
|
+
}, [t, e]), !t || !d ? null : /* @__PURE__ */ (0, l.jsx)(c, {
|
|
21
|
+
i18n: t,
|
|
22
|
+
children: /* @__PURE__ */ (0, l.jsx)(u.Provider, {
|
|
23
|
+
value: {
|
|
24
|
+
currentLang: i,
|
|
25
|
+
switchLanguage: (e) => {
|
|
26
|
+
t.changeLanguage(e), o(e), localStorage.setItem(n, JSON.stringify(e));
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
children: r
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { d as n, u as t };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { r as e, t } from "./chunk-DeC0fbbY.js";
|
|
2
|
+
import { n, r } from "./initReactI18next-AIGy7ACI.js";
|
|
3
|
+
import { n as i, r as a } from "./jsx-runtime-BJITdUlL.js";
|
|
4
|
+
import { useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
5
|
+
//#region node_modules/react-i18next/dist/es/utils.js
|
|
6
|
+
var f = (e, t, n, r) => {
|
|
7
|
+
let i = [n, {
|
|
8
|
+
code: t,
|
|
9
|
+
...r || {}
|
|
10
|
+
}];
|
|
11
|
+
if (e?.services?.logger?.forward) return e.services.logger.forward(i, "warn", "react-i18next::", !0);
|
|
12
|
+
b(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), e?.services?.logger?.warn ? e.services.logger.warn(...i) : console?.warn && console.warn(...i);
|
|
13
|
+
}, p = {}, m = (e, t, n, r) => {
|
|
14
|
+
b(n) && p[n] || (b(n) && (p[n] = /* @__PURE__ */ new Date()), f(e, t, n, r));
|
|
15
|
+
}, h = (e, t) => () => {
|
|
16
|
+
if (e.isInitialized) t();
|
|
17
|
+
else {
|
|
18
|
+
let n = () => {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
e.off("initialized", n);
|
|
21
|
+
}, 0), t();
|
|
22
|
+
};
|
|
23
|
+
e.on("initialized", n);
|
|
24
|
+
}
|
|
25
|
+
}, g = (e, t, n) => {
|
|
26
|
+
e.loadNamespaces(t, h(e, n));
|
|
27
|
+
}, _ = (e, t, n, r) => {
|
|
28
|
+
if (b(n) && (n = [n]), e.options.preload && e.options.preload.indexOf(t) > -1) return g(e, n, r);
|
|
29
|
+
n.forEach((t) => {
|
|
30
|
+
e.options.ns.indexOf(t) < 0 && e.options.ns.push(t);
|
|
31
|
+
}), e.loadLanguages(t, h(e, r));
|
|
32
|
+
}, v = (e, t, n = {}) => !t.languages || !t.languages.length ? (m(t, "NO_LANGUAGES", "i18n.languages were undefined or empty", { languages: t.languages }), !0) : t.hasLoadedNamespace(e, {
|
|
33
|
+
lng: n.lng,
|
|
34
|
+
precheck: (t, r) => {
|
|
35
|
+
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && t.services.backendConnector.backend && t.isLanguageChangingTo && !r(t.isLanguageChangingTo, e)) return !1;
|
|
36
|
+
}
|
|
37
|
+
}), y = (e) => e.displayName || e.name || (b(e) && e.length > 0 ? e : "Unknown"), b = (e) => typeof e == "string", x = (e) => typeof e == "object" && !!e, S = /* @__PURE__ */ t(((t) => {
|
|
38
|
+
var n = e("react");
|
|
39
|
+
function r(e, t) {
|
|
40
|
+
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
41
|
+
}
|
|
42
|
+
var i = typeof Object.is == "function" ? Object.is : r, a = n.useState, o = n.useEffect, s = n.useLayoutEffect, c = n.useDebugValue;
|
|
43
|
+
function l(e, t) {
|
|
44
|
+
var n = t(), r = a({ inst: {
|
|
45
|
+
value: n,
|
|
46
|
+
getSnapshot: t
|
|
47
|
+
} }), i = r[0].inst, l = r[1];
|
|
48
|
+
return s(function() {
|
|
49
|
+
i.value = n, i.getSnapshot = t, u(i) && l({ inst: i });
|
|
50
|
+
}, [
|
|
51
|
+
e,
|
|
52
|
+
n,
|
|
53
|
+
t
|
|
54
|
+
]), o(function() {
|
|
55
|
+
return u(i) && l({ inst: i }), e(function() {
|
|
56
|
+
u(i) && l({ inst: i });
|
|
57
|
+
});
|
|
58
|
+
}, [e]), c(n), n;
|
|
59
|
+
}
|
|
60
|
+
function u(e) {
|
|
61
|
+
var t = e.getSnapshot;
|
|
62
|
+
e = e.value;
|
|
63
|
+
try {
|
|
64
|
+
var n = t();
|
|
65
|
+
return !i(e, n);
|
|
66
|
+
} catch {
|
|
67
|
+
return !0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function d(e, t) {
|
|
71
|
+
return t();
|
|
72
|
+
}
|
|
73
|
+
var f = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? d : l;
|
|
74
|
+
t.useSyncExternalStore = n.useSyncExternalStore === void 0 ? f : n.useSyncExternalStore;
|
|
75
|
+
})), C = /* @__PURE__ */ t(((t) => {
|
|
76
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
77
|
+
function n(e, t) {
|
|
78
|
+
return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
|
|
79
|
+
}
|
|
80
|
+
function r(e, t) {
|
|
81
|
+
f || o.startTransition === void 0 || (f = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
82
|
+
var n = t();
|
|
83
|
+
if (!p) {
|
|
84
|
+
var r = t();
|
|
85
|
+
s(n, r) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), p = !0);
|
|
86
|
+
}
|
|
87
|
+
r = c({ inst: {
|
|
88
|
+
value: n,
|
|
89
|
+
getSnapshot: t
|
|
90
|
+
} });
|
|
91
|
+
var a = r[0].inst, m = r[1];
|
|
92
|
+
return u(function() {
|
|
93
|
+
a.value = n, a.getSnapshot = t, i(a) && m({ inst: a });
|
|
94
|
+
}, [
|
|
95
|
+
e,
|
|
96
|
+
n,
|
|
97
|
+
t
|
|
98
|
+
]), l(function() {
|
|
99
|
+
return i(a) && m({ inst: a }), e(function() {
|
|
100
|
+
i(a) && m({ inst: a });
|
|
101
|
+
});
|
|
102
|
+
}, [e]), d(n), n;
|
|
103
|
+
}
|
|
104
|
+
function i(e) {
|
|
105
|
+
var t = e.getSnapshot;
|
|
106
|
+
e = e.value;
|
|
107
|
+
try {
|
|
108
|
+
var n = t();
|
|
109
|
+
return !s(e, n);
|
|
110
|
+
} catch {
|
|
111
|
+
return !0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function a(e, t) {
|
|
115
|
+
return t();
|
|
116
|
+
}
|
|
117
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
118
|
+
var o = e("react"), s = typeof Object.is == "function" ? Object.is : n, c = o.useState, l = o.useEffect, u = o.useLayoutEffect, d = o.useDebugValue, f = !1, p = !1, m = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? a : r;
|
|
119
|
+
t.useSyncExternalStore = o.useSyncExternalStore === void 0 ? m : o.useSyncExternalStore, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
120
|
+
})();
|
|
121
|
+
})), w = (/* @__PURE__ */ t(((e, t) => {
|
|
122
|
+
process.env.NODE_ENV === "production" ? t.exports = S() : t.exports = C();
|
|
123
|
+
})))(), T = {
|
|
124
|
+
t: (e, t) => {
|
|
125
|
+
if (b(t)) return t;
|
|
126
|
+
if (x(t) && b(t.defaultValue)) return t.defaultValue;
|
|
127
|
+
if (typeof e == "function") return "";
|
|
128
|
+
if (Array.isArray(e)) {
|
|
129
|
+
let t = e[e.length - 1];
|
|
130
|
+
return typeof t == "function" ? "" : t;
|
|
131
|
+
}
|
|
132
|
+
return e;
|
|
133
|
+
},
|
|
134
|
+
ready: !1
|
|
135
|
+
}, E = () => () => {}, D = (e, t = {}) => {
|
|
136
|
+
let { i18n: f } = t, { i18n: p, defaultNS: h } = s(i) || {}, y = f || p || n();
|
|
137
|
+
y && !y.reportNamespaces && (y.reportNamespaces = new a()), y || m(y, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
138
|
+
let x = l(() => ({
|
|
139
|
+
...r(),
|
|
140
|
+
...y?.options?.react,
|
|
141
|
+
...t
|
|
142
|
+
}), [y, t]), { useSuspense: S, keyPrefix: C } = x, D = e || h || y?.options?.defaultNS, O = b(D) ? [D] : D || ["translation"], k = l(() => O, O);
|
|
143
|
+
y?.reportNamespaces?.addUsedNamespaces?.(k);
|
|
144
|
+
let A = u(0), j = o((e) => {
|
|
145
|
+
if (!y) return E;
|
|
146
|
+
let { bindI18n: t, bindI18nStore: n } = x, r = () => {
|
|
147
|
+
A.current += 1, e();
|
|
148
|
+
};
|
|
149
|
+
return t && y.on(t, r), n && y.store.on(n, r), () => {
|
|
150
|
+
t && t.split(" ").forEach((e) => y.off(e, r)), n && n.split(" ").forEach((e) => y.store.off(e, r));
|
|
151
|
+
};
|
|
152
|
+
}, [y, x]), M = u(), N = o(() => {
|
|
153
|
+
if (!y) return T;
|
|
154
|
+
let e = !!(y.isInitialized || y.initializedStoreOnce) && k.every((e) => v(e, y, x)), n = t.lng || y.language, r = A.current, i = M.current;
|
|
155
|
+
if (i && i.ready === e && i.lng === n && i.keyPrefix === C && i.revision === r) return i;
|
|
156
|
+
let a = {
|
|
157
|
+
t: y.getFixedT(n, x.nsMode === "fallback" ? k : k[0], C),
|
|
158
|
+
ready: e,
|
|
159
|
+
lng: n,
|
|
160
|
+
keyPrefix: C,
|
|
161
|
+
revision: r
|
|
162
|
+
};
|
|
163
|
+
return M.current = a, a;
|
|
164
|
+
}, [
|
|
165
|
+
y,
|
|
166
|
+
k,
|
|
167
|
+
C,
|
|
168
|
+
x,
|
|
169
|
+
t.lng
|
|
170
|
+
]), [P, F] = d(0), { t: I, ready: L } = (0, w.useSyncExternalStore)(j, N, N);
|
|
171
|
+
c(() => {
|
|
172
|
+
if (y && !L && !S) {
|
|
173
|
+
let e = () => F((e) => e + 1);
|
|
174
|
+
t.lng ? _(y, t.lng, k, e) : g(y, k, e);
|
|
175
|
+
}
|
|
176
|
+
}, [
|
|
177
|
+
y,
|
|
178
|
+
t.lng,
|
|
179
|
+
k,
|
|
180
|
+
L,
|
|
181
|
+
S,
|
|
182
|
+
P
|
|
183
|
+
]);
|
|
184
|
+
let R = y || {}, z = u(null), B = u(), V = (e) => {
|
|
185
|
+
let t = Object.getOwnPropertyDescriptors(e);
|
|
186
|
+
t.__original && delete t.__original;
|
|
187
|
+
let n = Object.create(Object.getPrototypeOf(e), t);
|
|
188
|
+
if (!Object.prototype.hasOwnProperty.call(n, "__original")) try {
|
|
189
|
+
Object.defineProperty(n, "__original", {
|
|
190
|
+
value: e,
|
|
191
|
+
writable: !1,
|
|
192
|
+
enumerable: !1,
|
|
193
|
+
configurable: !1
|
|
194
|
+
});
|
|
195
|
+
} catch {}
|
|
196
|
+
return n;
|
|
197
|
+
}, H = l(() => {
|
|
198
|
+
let e = R, t = e?.language, n = e;
|
|
199
|
+
e && (z.current && z.current.__original === e && B.current === t ? n = z.current : (n = V(e), z.current = n, B.current = t));
|
|
200
|
+
let r = !L && !S ? (...e) => (m(y, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."), I(...e)) : I, i = [
|
|
201
|
+
r,
|
|
202
|
+
n,
|
|
203
|
+
L
|
|
204
|
+
];
|
|
205
|
+
return i.t = r, i.i18n = n, i.ready = L, i;
|
|
206
|
+
}, [
|
|
207
|
+
I,
|
|
208
|
+
R,
|
|
209
|
+
L,
|
|
210
|
+
R.resolvedLanguage,
|
|
211
|
+
R.language,
|
|
212
|
+
R.languages
|
|
213
|
+
]);
|
|
214
|
+
if (y && S && !L) throw new Promise((e) => {
|
|
215
|
+
let n = () => e();
|
|
216
|
+
t.lng ? _(y, t.lng, k, n) : g(y, k, n);
|
|
217
|
+
});
|
|
218
|
+
return H;
|
|
219
|
+
};
|
|
220
|
+
//#endregion
|
|
221
|
+
export { f as a, b as i, y as n, m as o, x as r, D as t };
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { n as e } from "../chunk-DeC0fbbY.js";
|
|
2
|
+
//#region src/utils/constants.ts
|
|
3
|
+
var t = /* @__PURE__ */ e({
|
|
4
|
+
ALL_LANGUAGES: () => n,
|
|
5
|
+
DEFAULT_LANGUAGE: () => "EN",
|
|
6
|
+
LANGUAGE_KEY: () => r
|
|
7
|
+
}), n = Object.freeze({
|
|
8
|
+
ACH: "Translations",
|
|
9
|
+
EN: "English",
|
|
10
|
+
AR: "العربية",
|
|
11
|
+
BN: "বাংলা",
|
|
12
|
+
DE: "Deutsch",
|
|
13
|
+
ES: "Español",
|
|
14
|
+
FR: "Français",
|
|
15
|
+
ID: "Indonesian",
|
|
16
|
+
IT: "Italiano",
|
|
17
|
+
SW: "Kiswahili",
|
|
18
|
+
TA: "தமிழ்",
|
|
19
|
+
KM: "ខ្មែរ",
|
|
20
|
+
KO: "한국어",
|
|
21
|
+
MN: "Монгол",
|
|
22
|
+
PL: "Polish",
|
|
23
|
+
PT: "Português",
|
|
24
|
+
RU: "Русский",
|
|
25
|
+
SI: "සිංහල",
|
|
26
|
+
TH: "ไทย",
|
|
27
|
+
TR: "Türkçe",
|
|
28
|
+
UZ: "O'zbek",
|
|
29
|
+
VI: "Tiếng Việt",
|
|
30
|
+
ZH_CN: "简体中文",
|
|
31
|
+
ZH_TW: "繁體中文"
|
|
32
|
+
}), r = "i18n_language", i = "EN";
|
|
33
|
+
//#endregion
|
|
34
|
+
export { n as ALL_LANGUAGES, i as DEFAULT_LANGUAGE, r as LANGUAGE_KEY, t };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
r as OtaSdk,
|
|
8
|
-
i as constants,
|
|
9
|
-
d as getAllowedLanguages,
|
|
10
|
-
g as getInitialLanguage,
|
|
11
|
-
e as initializeI18n,
|
|
12
|
-
x as loadIncontextTranslation,
|
|
13
|
-
l as localize
|
|
14
|
-
};
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../utils-17GMfKvo.js";
|
|
2
|
+
import i from "./localize.js";
|
|
3
|
+
import a from "./otasdk.js";
|
|
4
|
+
import { t as o } from "./constants.js";
|
|
5
|
+
export { a as OtaSdk, o as constants, r as getAllowedLanguages, t as getInitialLanguage, e as initializeI18n, n as loadIncontextTranslation, i as localize };
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
|
|
3
|
-
import { getInitialLanguage as l } from "./lang-utils.js";
|
|
4
|
-
import { s as u, a as f } from "../i18nInstance-D3STmr24.js";
|
|
5
|
-
const m = {
|
|
6
|
-
type: "3rdParty",
|
|
7
|
-
init(t) {
|
|
8
|
-
u(t.options.react), f(t);
|
|
9
|
-
}
|
|
10
|
-
}, g = ({ useSuspense: t, enableDebug: e }) => ({
|
|
11
|
-
react: {
|
|
12
|
-
hashTransKey(n) {
|
|
13
|
-
return o.str(n);
|
|
14
|
-
},
|
|
15
|
-
useSuspense: t
|
|
16
|
-
},
|
|
17
|
-
debug: e,
|
|
18
|
-
initImmediate: !0,
|
|
19
|
-
fallbackLng: "EN",
|
|
20
|
-
interpolation: {
|
|
21
|
-
escapeValue: !1
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
function y({
|
|
25
|
-
cdnUrl: t,
|
|
26
|
-
useSuspense: e = !0,
|
|
27
|
-
enableDebug: n = !1
|
|
28
|
-
}) {
|
|
29
|
-
const i = new c(t), s = l(), r = g({ useSuspense: e, enableDebug: n });
|
|
30
|
-
return a.use(i).use(m).init({ ...r, lng: s }), a;
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
y as default
|
|
34
|
-
};
|
|
1
|
+
import { i as e } from "../utils-17GMfKvo.js";
|
|
2
|
+
export { e as default };
|
package/dist/utils/lang-utils.js
CHANGED
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
|
|
3
|
-
const p = () => {
|
|
4
|
-
const a = new URLSearchParams(window.location.search).get("lang");
|
|
5
|
-
let t = localStorage.getItem(s) ?? '"EN"';
|
|
6
|
-
/^".*"$/.test(t) || (localStorage.setItem(s, JSON.stringify(t)), t = localStorage.getItem(s));
|
|
7
|
-
const e = JSON.parse(t);
|
|
8
|
-
if (a) {
|
|
9
|
-
const r = a.toUpperCase();
|
|
10
|
-
return localStorage.setItem(s, JSON.stringify(r)), r;
|
|
11
|
-
}
|
|
12
|
-
return e || c;
|
|
13
|
-
}, g = (n) => {
|
|
14
|
-
if (n.toUpperCase() === "ACH") {
|
|
15
|
-
const t = document.createElement("script");
|
|
16
|
-
t.type = "text/javascript", t.text = `
|
|
17
|
-
var _jipt = []; _jipt.push(['project', 'deriv-app']);
|
|
18
|
-
var crowdin = document.createElement("script");
|
|
19
|
-
crowdin.setAttribute('src', '//cdn.crowdin.com/jipt/jipt.js');
|
|
20
|
-
document.head.appendChild(crowdin);
|
|
21
|
-
`, document.head.appendChild(t);
|
|
22
|
-
}
|
|
23
|
-
}, u = (n = []) => {
|
|
24
|
-
const a = ["ACH", ...n];
|
|
25
|
-
return Object.keys(o).filter((e) => !a.includes(e)).reduce((e, r) => (e[r] = o[r], e), {});
|
|
26
|
-
};
|
|
27
|
-
export {
|
|
28
|
-
u as getAllowedLanguages,
|
|
29
|
-
p as getInitialLanguage,
|
|
30
|
-
g as loadIncontextTranslation
|
|
31
|
-
};
|
|
1
|
+
import { n as e, r as t, t as n } from "../utils-17GMfKvo.js";
|
|
2
|
+
export { n as getAllowedLanguages, e as getInitialLanguage, t as loadIncontextTranslation };
|
package/dist/utils/localize.js
CHANGED
|
@@ -1,10 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { t as e } from "../chunk-DeC0fbbY.js";
|
|
2
|
+
import { t } from "../i18next-DzZwHOzH.js";
|
|
3
|
+
//#region node_modules/crc-32/crc32.js
|
|
4
|
+
var n = /* @__PURE__ */ e(((e) => {
|
|
5
|
+
(function(t) {
|
|
6
|
+
typeof DO_NOT_EXPORT_CRC > "u" ? typeof e == "object" ? t(e) : typeof define == "function" && define.amd ? define(function() {
|
|
7
|
+
var e = {};
|
|
8
|
+
return t(e), e;
|
|
9
|
+
}) : t({}) : t({});
|
|
10
|
+
})(function(e) {
|
|
11
|
+
e.version = "1.2.2";
|
|
12
|
+
function t() {
|
|
13
|
+
for (var e = 0, t = Array(256), n = 0; n != 256; ++n) e = n, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, e = e & 1 ? -306674912 ^ e >>> 1 : e >>> 1, t[n] = e;
|
|
14
|
+
return typeof Int32Array < "u" ? new Int32Array(t) : t;
|
|
15
|
+
}
|
|
16
|
+
var n = t();
|
|
17
|
+
function r(e) {
|
|
18
|
+
var t = 0, n = 0, r = 0, i = typeof Int32Array < "u" ? new Int32Array(4096) : Array(4096);
|
|
19
|
+
for (r = 0; r != 256; ++r) i[r] = e[r];
|
|
20
|
+
for (r = 0; r != 256; ++r) for (n = e[r], t = 256 + r; t < 4096; t += 256) n = i[t] = n >>> 8 ^ e[n & 255];
|
|
21
|
+
var a = [];
|
|
22
|
+
for (r = 1; r != 16; ++r) a[r - 1] = typeof Int32Array < "u" ? i.subarray(r * 256, r * 256 + 256) : i.slice(r * 256, r * 256 + 256);
|
|
23
|
+
return a;
|
|
24
|
+
}
|
|
25
|
+
var i = r(n), a = i[0], o = i[1], s = i[2], c = i[3], l = i[4], u = i[5], d = i[6], f = i[7], p = i[8], m = i[9], h = i[10], g = i[11], _ = i[12], v = i[13], y = i[14];
|
|
26
|
+
function b(e, t) {
|
|
27
|
+
for (var r = t ^ -1, i = 0, a = e.length; i < a;) r = r >>> 8 ^ n[(r ^ e.charCodeAt(i++)) & 255];
|
|
28
|
+
return ~r;
|
|
29
|
+
}
|
|
30
|
+
function x(e, t) {
|
|
31
|
+
for (var r = t ^ -1, i = e.length - 15, b = 0; b < i;) r = y[e[b++] ^ r & 255] ^ v[e[b++] ^ r >> 8 & 255] ^ _[e[b++] ^ r >> 16 & 255] ^ g[e[b++] ^ r >>> 24] ^ h[e[b++]] ^ m[e[b++]] ^ p[e[b++]] ^ f[e[b++]] ^ d[e[b++]] ^ u[e[b++]] ^ l[e[b++]] ^ c[e[b++]] ^ s[e[b++]] ^ o[e[b++]] ^ a[e[b++]] ^ n[e[b++]];
|
|
32
|
+
for (i += 15; b < i;) r = r >>> 8 ^ n[(r ^ e[b++]) & 255];
|
|
33
|
+
return ~r;
|
|
34
|
+
}
|
|
35
|
+
function S(e, t) {
|
|
36
|
+
for (var r = t ^ -1, i = 0, a = e.length, o = 0, s = 0; i < a;) o = e.charCodeAt(i++), o < 128 ? r = r >>> 8 ^ n[(r ^ o) & 255] : o < 2048 ? (r = r >>> 8 ^ n[(r ^ (192 | o >> 6 & 31)) & 255], r = r >>> 8 ^ n[(r ^ (128 | o & 63)) & 255]) : o >= 55296 && o < 57344 ? (o = (o & 1023) + 64, s = e.charCodeAt(i++) & 1023, r = r >>> 8 ^ n[(r ^ (240 | o >> 8 & 7)) & 255], r = r >>> 8 ^ n[(r ^ (128 | o >> 2 & 63)) & 255], r = r >>> 8 ^ n[(r ^ (128 | s >> 6 & 15 | (o & 3) << 4)) & 255], r = r >>> 8 ^ n[(r ^ (128 | s & 63)) & 255]) : (r = r >>> 8 ^ n[(r ^ (224 | o >> 12 & 15)) & 255], r = r >>> 8 ^ n[(r ^ (128 | o >> 6 & 63)) & 255], r = r >>> 8 ^ n[(r ^ (128 | o & 63)) & 255]);
|
|
37
|
+
return ~r;
|
|
38
|
+
}
|
|
39
|
+
e.table = n, e.bstr = b, e.buf = x, e.str = S;
|
|
40
|
+
});
|
|
41
|
+
})), r = n();
|
|
42
|
+
function i(e, n) {
|
|
43
|
+
return e ? t.t((0, r.str)(e).toString(), {
|
|
44
|
+
defaultValue: e,
|
|
45
|
+
...n
|
|
46
|
+
}) : "";
|
|
7
47
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { i as default, n as t };
|
package/dist/utils/otasdk.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
a as default
|
|
1
|
+
//#region src/utils/otasdk.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
type;
|
|
4
|
+
cdnUrl;
|
|
5
|
+
constructor(e) {
|
|
6
|
+
this.type = "backend", this.cdnUrl = e;
|
|
7
|
+
}
|
|
8
|
+
read(e, t, n) {
|
|
9
|
+
fetch(this.cdnUrl + "/translations/" + e.toLowerCase() + ".json").then((e) => {
|
|
10
|
+
if (!e.ok) throw Error("Failed to fetch translations");
|
|
11
|
+
return e.json();
|
|
12
|
+
}).then((e) => {
|
|
13
|
+
n(null, e);
|
|
14
|
+
}).catch(() => {
|
|
15
|
+
n(null, {});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
21
18
|
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { t as e } from "./i18next-DzZwHOzH.js";
|
|
2
|
+
import { t } from "./initReactI18next-AIGy7ACI.js";
|
|
3
|
+
import { t as n } from "./utils/localize.js";
|
|
4
|
+
import r from "./utils/otasdk.js";
|
|
5
|
+
import { ALL_LANGUAGES as i, LANGUAGE_KEY as a } from "./utils/constants.js";
|
|
6
|
+
//#region src/utils/initialize-i18n.ts
|
|
7
|
+
var o = n(), s = ({ useSuspense: e, enableDebug: t }) => ({
|
|
8
|
+
react: {
|
|
9
|
+
hashTransKey(e) {
|
|
10
|
+
return (0, o.str)(e);
|
|
11
|
+
},
|
|
12
|
+
useSuspense: e
|
|
13
|
+
},
|
|
14
|
+
debug: t,
|
|
15
|
+
initImmediate: !0,
|
|
16
|
+
fallbackLng: "EN",
|
|
17
|
+
interpolation: { escapeValue: !1 }
|
|
18
|
+
});
|
|
19
|
+
function c({ cdnUrl: n, useSuspense: i = !0, enableDebug: a = !1 }) {
|
|
20
|
+
let o = new r(n), c = l(), u = s({
|
|
21
|
+
useSuspense: i,
|
|
22
|
+
enableDebug: a
|
|
23
|
+
});
|
|
24
|
+
return e.use(o).use(t).init({
|
|
25
|
+
...u,
|
|
26
|
+
lng: c
|
|
27
|
+
}), e;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/utils/lang-utils.ts
|
|
31
|
+
var l = () => {
|
|
32
|
+
let e = new URLSearchParams(window.location.search).get("lang"), t = localStorage.getItem("i18n_language") ?? "\"EN\"";
|
|
33
|
+
/^".*"$/.test(t) || (localStorage.setItem(a, JSON.stringify(t)), t = localStorage.getItem(a));
|
|
34
|
+
let n = JSON.parse(t);
|
|
35
|
+
if (e) {
|
|
36
|
+
let t = e.toUpperCase();
|
|
37
|
+
return localStorage.setItem(a, JSON.stringify(t)), t;
|
|
38
|
+
}
|
|
39
|
+
return n || "EN";
|
|
40
|
+
}, u = (e) => {
|
|
41
|
+
if (e.toUpperCase() === "ACH") {
|
|
42
|
+
let e = document.createElement("script");
|
|
43
|
+
e.type = "text/javascript", e.text = "\n var _jipt = []; _jipt.push(['project', 'deriv-app']);\n var crowdin = document.createElement(\"script\");\n crowdin.setAttribute('src', '//cdn.crowdin.com/jipt/jipt.js');\n document.head.appendChild(crowdin);\n ", document.head.appendChild(e);
|
|
44
|
+
}
|
|
45
|
+
}, d = (e = []) => {
|
|
46
|
+
let t = ["ACH", ...e];
|
|
47
|
+
return Object.keys(i).filter((e) => !t.includes(e)).reduce((e, t) => (e[t] = i[t], e), {});
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { c as i, l as n, u as r, d as t };
|