@deriv-com/translations 0.0.0-development
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/LICENSE +21 -0
- package/README.md +135 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/localize.d.ts +9 -0
- package/dist/components/localize.js +365 -0
- package/dist/constants-XUr5oono.js +29 -0
- package/dist/context-NlNsLXrG.js +19 -0
- package/dist/crc32-bHbojQDz.js +1593 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +12 -0
- package/dist/hooks/use-translations.d.ts +7 -0
- package/dist/hooks/use-translations.js +91 -0
- package/dist/i18nInstance-I4t--qpO.js +55 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +23 -0
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.js +10 -0
- package/dist/provider/translation-provider.d.ts +11 -0
- package/dist/provider/translation-provider.js +50 -0
- package/dist/utils/constants.d.ts +20 -0
- package/dist/utils/constants.js +6 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/initialize-i18n.d.ts +3 -0
- package/dist/utils/initialize-i18n.js +31 -0
- package/dist/utils/lang-utils.d.ts +3 -0
- package/dist/utils/lang-utils.js +24 -0
- package/dist/utils/localize.d.ts +8 -0
- package/dist/utils/localize.js +10 -0
- package/dist/utils/otasdk.d.ts +13 -0
- package/dist/utils/otasdk.js +24 -0
- package/dist/utils-L82GdMuf.js +61 -0
- package/package.json +503 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useTranslations } from "./use-translations";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as l } from "./use-translations.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../provider/translation-provider.js";
|
|
4
|
+
import "react/jsx-runtime";
|
|
5
|
+
import "../crc32-bHbojQDz.js";
|
|
6
|
+
import "../constants-XUr5oono.js";
|
|
7
|
+
import "../context-NlNsLXrG.js";
|
|
8
|
+
import "../utils-L82GdMuf.js";
|
|
9
|
+
import "../i18nInstance-I4t--qpO.js";
|
|
10
|
+
export {
|
|
11
|
+
l as useTranslations
|
|
12
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useContext as P, useState as E, useRef as N, useEffect as w } from "react";
|
|
2
|
+
import { TranslationContext as F } from "../provider/translation-provider.js";
|
|
3
|
+
import { c as j } from "../crc32-bHbojQDz.js";
|
|
4
|
+
import { I as v, R as z } from "../context-NlNsLXrG.js";
|
|
5
|
+
import { w as R, h as A, l as C, a as L } from "../utils-L82GdMuf.js";
|
|
6
|
+
import { g as M, b as U } from "../i18nInstance-I4t--qpO.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "../constants-XUr5oono.js";
|
|
9
|
+
const $ = (a, t) => {
|
|
10
|
+
const c = N();
|
|
11
|
+
return w(() => {
|
|
12
|
+
c.current = t ? c.current : a;
|
|
13
|
+
}, [a, t]), c.current;
|
|
14
|
+
};
|
|
15
|
+
function J(a) {
|
|
16
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
17
|
+
const {
|
|
18
|
+
i18n: c
|
|
19
|
+
} = t, {
|
|
20
|
+
i18n: y,
|
|
21
|
+
defaultNS: h
|
|
22
|
+
} = P(v) || {}, e = c || y || U();
|
|
23
|
+
if (e && !e.reportNamespaces && (e.reportNamespaces = new z()), !e) {
|
|
24
|
+
R("You will need to pass in an i18next instance by using initReactI18next");
|
|
25
|
+
const r = (i, s) => typeof s == "string" ? s : s && typeof s == "object" && typeof s.defaultValue == "string" ? s.defaultValue : Array.isArray(i) ? i[i.length - 1] : i, o = [r, {}, !1];
|
|
26
|
+
return o.t = r, o.i18n = {}, o.ready = !1, o;
|
|
27
|
+
}
|
|
28
|
+
e.options.react && e.options.react.wait !== void 0 && R("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
29
|
+
const f = {
|
|
30
|
+
...M(),
|
|
31
|
+
...e.options.react,
|
|
32
|
+
...t
|
|
33
|
+
}, {
|
|
34
|
+
useSuspense: x,
|
|
35
|
+
keyPrefix: S
|
|
36
|
+
} = f;
|
|
37
|
+
let n = a || h || e.options && e.options.defaultNS;
|
|
38
|
+
n = typeof n == "string" ? [n] : n || ["translation"], e.reportNamespaces.addUsedNamespaces && e.reportNamespaces.addUsedNamespaces(n);
|
|
39
|
+
const l = (e.isInitialized || e.initializedStoreOnce) && n.every((r) => A(r, e, f));
|
|
40
|
+
function d() {
|
|
41
|
+
return e.getFixedT(t.lng || null, f.nsMode === "fallback" ? n : n[0], S);
|
|
42
|
+
}
|
|
43
|
+
const [b, p] = E(d);
|
|
44
|
+
let m = n.join();
|
|
45
|
+
t.lng && (m = `${t.lng}${m}`);
|
|
46
|
+
const I = $(m), u = N(!0);
|
|
47
|
+
w(() => {
|
|
48
|
+
const {
|
|
49
|
+
bindI18n: r,
|
|
50
|
+
bindI18nStore: o
|
|
51
|
+
} = f;
|
|
52
|
+
u.current = !0, !l && !x && (t.lng ? C(e, t.lng, n, () => {
|
|
53
|
+
u.current && p(d);
|
|
54
|
+
}) : L(e, n, () => {
|
|
55
|
+
u.current && p(d);
|
|
56
|
+
})), l && I && I !== m && u.current && p(d);
|
|
57
|
+
function i() {
|
|
58
|
+
u.current && p(d);
|
|
59
|
+
}
|
|
60
|
+
return r && e && e.on(r, i), o && e && e.store.on(o, i), () => {
|
|
61
|
+
u.current = !1, r && e && r.split(" ").forEach((s) => e.off(s, i)), o && e && o.split(" ").forEach((s) => e.store.off(s, i));
|
|
62
|
+
};
|
|
63
|
+
}, [e, m]);
|
|
64
|
+
const T = N(!0);
|
|
65
|
+
w(() => {
|
|
66
|
+
u.current && !T.current && p(d), T.current = !1;
|
|
67
|
+
}, [e, S]);
|
|
68
|
+
const g = [b, e, l];
|
|
69
|
+
if (g.t = b, g.i18n = e, g.ready = l, l || !l && !x)
|
|
70
|
+
return g;
|
|
71
|
+
throw new Promise((r) => {
|
|
72
|
+
t.lng ? C(e, t.lng, n, () => r()) : L(e, n, () => r());
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function X() {
|
|
76
|
+
const a = P(F), { ready: t, t: c, i18n: y } = J(), h = (e, f = {}) => c(j.str(e).toString(), { defaultValue: e, ...f });
|
|
77
|
+
if (!a)
|
|
78
|
+
throw new Error(
|
|
79
|
+
"useTranslation has to be used within <TranslationContext.Provider>"
|
|
80
|
+
);
|
|
81
|
+
return {
|
|
82
|
+
ready: t,
|
|
83
|
+
localize: h,
|
|
84
|
+
instance: y,
|
|
85
|
+
switchLanguage: a.switchLanguage,
|
|
86
|
+
currentLang: a.currentLang
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
X as default
|
|
91
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const s = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, a = {
|
|
2
|
+
"&": "&",
|
|
3
|
+
"&": "&",
|
|
4
|
+
"<": "<",
|
|
5
|
+
"<": "<",
|
|
6
|
+
">": ">",
|
|
7
|
+
">": ">",
|
|
8
|
+
"'": "'",
|
|
9
|
+
"'": "'",
|
|
10
|
+
""": '"',
|
|
11
|
+
""": '"',
|
|
12
|
+
" ": " ",
|
|
13
|
+
" ": " ",
|
|
14
|
+
"©": "©",
|
|
15
|
+
"©": "©",
|
|
16
|
+
"®": "®",
|
|
17
|
+
"®": "®",
|
|
18
|
+
"…": "…",
|
|
19
|
+
"…": "…",
|
|
20
|
+
"/": "/",
|
|
21
|
+
"/": "/"
|
|
22
|
+
}, o = (t) => a[t], u = (t) => t.replace(s, o);
|
|
23
|
+
let e = {
|
|
24
|
+
bindI18n: "languageChanged",
|
|
25
|
+
bindI18nStore: "",
|
|
26
|
+
transEmptyNodeValue: "",
|
|
27
|
+
transSupportBasicHtmlNodes: !0,
|
|
28
|
+
transWrapTextNodes: "",
|
|
29
|
+
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
30
|
+
useSuspense: !0,
|
|
31
|
+
unescape: u
|
|
32
|
+
};
|
|
33
|
+
function p() {
|
|
34
|
+
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
35
|
+
e = {
|
|
36
|
+
...e,
|
|
37
|
+
...t
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function r() {
|
|
41
|
+
return e;
|
|
42
|
+
}
|
|
43
|
+
let n;
|
|
44
|
+
function l(t) {
|
|
45
|
+
n = t;
|
|
46
|
+
}
|
|
47
|
+
function i() {
|
|
48
|
+
return n;
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
l as a,
|
|
52
|
+
i as b,
|
|
53
|
+
r as g,
|
|
54
|
+
p as s
|
|
55
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as f } from "./utils/initialize-i18n.js";
|
|
2
|
+
import { default as d } from "./utils/localize.js";
|
|
3
|
+
import { getInitialLanguage as x, loadIncontextTranslation as c } from "./utils/lang-utils.js";
|
|
4
|
+
import { default as z } from "./components/localize.js";
|
|
5
|
+
import { default as T } from "./hooks/use-translations.js";
|
|
6
|
+
import { default as v } from "./provider/translation-provider.js";
|
|
7
|
+
import "./crc32-bHbojQDz.js";
|
|
8
|
+
import "./utils/otasdk.js";
|
|
9
|
+
import "./i18nInstance-I4t--qpO.js";
|
|
10
|
+
import "./constants-XUr5oono.js";
|
|
11
|
+
import "react/jsx-runtime";
|
|
12
|
+
import "react";
|
|
13
|
+
import "./utils-L82GdMuf.js";
|
|
14
|
+
import "./context-NlNsLXrG.js";
|
|
15
|
+
export {
|
|
16
|
+
z as Localize,
|
|
17
|
+
v as TranslationProvider,
|
|
18
|
+
x as getInitialLanguage,
|
|
19
|
+
f as initializeI18n,
|
|
20
|
+
c as loadIncontextTranslation,
|
|
21
|
+
d as localize,
|
|
22
|
+
T as useTranslations
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TranslationContext as n, default as e } from "./translation-provider.js";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import "../crc32-bHbojQDz.js";
|
|
5
|
+
import "../constants-XUr5oono.js";
|
|
6
|
+
import "../context-NlNsLXrG.js";
|
|
7
|
+
export {
|
|
8
|
+
n as TranslationContext,
|
|
9
|
+
e as TranslationProvider
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { constants } from '../utils/index';
|
|
2
|
+
import type { i18n as Ti18n } from "i18next";
|
|
3
|
+
export declare const TranslationContext: import("react").Context<{
|
|
4
|
+
currentLang: string;
|
|
5
|
+
switchLanguage: (lang: string) => void;
|
|
6
|
+
} | null>;
|
|
7
|
+
export default function TranslationProvider({ defaultLang, i18nInstance, children, }: {
|
|
8
|
+
defaultLang?: keyof Omit<typeof constants.ALL_LANGUAGES, "ACH">;
|
|
9
|
+
i18nInstance: Ti18n;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as f, createElement as c, createContext as g, useState as u, useEffect as m } from "react";
|
|
3
|
+
import "../crc32-bHbojQDz.js";
|
|
4
|
+
import { L } from "../constants-XUr5oono.js";
|
|
5
|
+
import { I as p } from "../context-NlNsLXrG.js";
|
|
6
|
+
function v(a) {
|
|
7
|
+
let {
|
|
8
|
+
i18n: e,
|
|
9
|
+
defaultNS: r,
|
|
10
|
+
children: n
|
|
11
|
+
} = a;
|
|
12
|
+
const o = f(() => ({
|
|
13
|
+
i18n: e,
|
|
14
|
+
defaultNS: r
|
|
15
|
+
}), [e, r]);
|
|
16
|
+
return c(p.Provider, {
|
|
17
|
+
value: o
|
|
18
|
+
}, n);
|
|
19
|
+
}
|
|
20
|
+
const x = g(null);
|
|
21
|
+
function S({
|
|
22
|
+
defaultLang: a,
|
|
23
|
+
i18nInstance: e,
|
|
24
|
+
children: r
|
|
25
|
+
}) {
|
|
26
|
+
const [n, o] = u(a || ""), [l, s] = u(!1), d = (t) => {
|
|
27
|
+
e.changeLanguage(t), o(t), localStorage.setItem(L, t);
|
|
28
|
+
};
|
|
29
|
+
return m(() => {
|
|
30
|
+
if (e) {
|
|
31
|
+
const t = e.language;
|
|
32
|
+
o(t), e.on("initialized", () => {
|
|
33
|
+
s(!0);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}, [e]), !e || !l ? null : /* @__PURE__ */ i(v, { i18n: e, children: /* @__PURE__ */ i(
|
|
37
|
+
x.Provider,
|
|
38
|
+
{
|
|
39
|
+
value: {
|
|
40
|
+
currentLang: n,
|
|
41
|
+
switchLanguage: d
|
|
42
|
+
},
|
|
43
|
+
children: r
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
x as TranslationContext,
|
|
49
|
+
S as default
|
|
50
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const ALL_LANGUAGES: Readonly<{
|
|
2
|
+
ACH: "Translations";
|
|
3
|
+
EN: "English";
|
|
4
|
+
ES: "Español";
|
|
5
|
+
DE: "Deutsch";
|
|
6
|
+
FR: "Français";
|
|
7
|
+
ID: "Indonesian";
|
|
8
|
+
IT: "Italiano";
|
|
9
|
+
KO: "한국어";
|
|
10
|
+
PL: "Polish";
|
|
11
|
+
PT: "Português";
|
|
12
|
+
RU: "Русский";
|
|
13
|
+
TR: "Türkçe";
|
|
14
|
+
VI: "Tiếng Việt";
|
|
15
|
+
ZH_CN: "简体中文";
|
|
16
|
+
ZH_TW: "繁體中文";
|
|
17
|
+
TH: "ไทย";
|
|
18
|
+
}>;
|
|
19
|
+
export declare const LANGUAGE_KEY = "i18n_language";
|
|
20
|
+
export declare const DEFAULT_LANGUAGE = "EN";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as r } from "./initialize-i18n.js";
|
|
2
|
+
import { default as n } from "./localize.js";
|
|
3
|
+
import { default as f } from "./otasdk.js";
|
|
4
|
+
import { c as p } from "../constants-XUr5oono.js";
|
|
5
|
+
import { getInitialLanguage as x, loadIncontextTranslation as d } from "./lang-utils.js";
|
|
6
|
+
import "../crc32-bHbojQDz.js";
|
|
7
|
+
import "../i18nInstance-I4t--qpO.js";
|
|
8
|
+
export {
|
|
9
|
+
f as OtaSdk,
|
|
10
|
+
p as constants,
|
|
11
|
+
x as getInitialLanguage,
|
|
12
|
+
r as initializeI18n,
|
|
13
|
+
d as loadIncontextTranslation,
|
|
14
|
+
n as localize
|
|
15
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { i as e, c as i } from "../crc32-bHbojQDz.js";
|
|
2
|
+
import s from "./otasdk.js";
|
|
3
|
+
import { getInitialLanguage as r } from "./lang-utils.js";
|
|
4
|
+
import { s as o, a as u } from "../i18nInstance-I4t--qpO.js";
|
|
5
|
+
import "../constants-XUr5oono.js";
|
|
6
|
+
const c = {
|
|
7
|
+
type: "3rdParty",
|
|
8
|
+
init(t) {
|
|
9
|
+
o(t.options.react), u(t);
|
|
10
|
+
}
|
|
11
|
+
}, l = {
|
|
12
|
+
react: {
|
|
13
|
+
hashTransKey(t) {
|
|
14
|
+
return i.str(t);
|
|
15
|
+
},
|
|
16
|
+
useSuspense: !0
|
|
17
|
+
},
|
|
18
|
+
debug: !1,
|
|
19
|
+
initImmediate: !0,
|
|
20
|
+
fallbackLng: "EN",
|
|
21
|
+
interpolation: {
|
|
22
|
+
escapeValue: !1
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function d({ cdnUrl: t }) {
|
|
26
|
+
const n = new s(t), a = r();
|
|
27
|
+
return e.use(n).use(c).init({ ...l, lng: a }), e;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
d as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../crc32-bHbojQDz.js";
|
|
2
|
+
import { L as n, D as o } from "../constants-XUr5oono.js";
|
|
3
|
+
const i = () => {
|
|
4
|
+
const e = new URLSearchParams(window.location.search).get("lang"), t = localStorage.getItem(n);
|
|
5
|
+
if (e) {
|
|
6
|
+
const r = e.toUpperCase();
|
|
7
|
+
return localStorage.setItem(n, r), r;
|
|
8
|
+
}
|
|
9
|
+
return t || o;
|
|
10
|
+
}, p = (a) => {
|
|
11
|
+
if (a.toUpperCase() === "ACH") {
|
|
12
|
+
const t = document.createElement("script");
|
|
13
|
+
t.type = "text/javascript", t.text = `
|
|
14
|
+
var _jipt = []; _jipt.push(['project', 'deriv-app']);
|
|
15
|
+
var crowdin = document.createElement("script");
|
|
16
|
+
crowdin.setAttribute('src', '//cdn.crowdin.com/jipt/jipt.js');
|
|
17
|
+
document.head.appendChild(crowdin);
|
|
18
|
+
`, document.head.appendChild(t);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
i as getInitialLanguage,
|
|
23
|
+
p as loadIncontextTranslation
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated use the `localize` function from the `useTranslations` hook
|
|
3
|
+
*
|
|
4
|
+
* @param {string} string
|
|
5
|
+
* @param {Record<string, unknown>} values
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export default function localize(string: string, values?: Record<string, unknown>): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModuleType } from "i18next";
|
|
2
|
+
interface OtaI18nextModule {
|
|
3
|
+
cdnUrl: string;
|
|
4
|
+
type: ModuleType;
|
|
5
|
+
}
|
|
6
|
+
type ReadCallback = (err: unknown, val: Record<string, unknown>) => void;
|
|
7
|
+
export default class OtaI18next implements OtaI18nextModule {
|
|
8
|
+
type: ModuleType;
|
|
9
|
+
cdnUrl: string;
|
|
10
|
+
constructor(cdnUrl: string);
|
|
11
|
+
read(language: string, _namespace: string, callback: ReadCallback): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var o = Object.defineProperty;
|
|
2
|
+
var c = (n, t, e) => t in n ? o(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var s = (n, t, e) => (c(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
class h {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
s(this, "type");
|
|
7
|
+
s(this, "cdnUrl");
|
|
8
|
+
this.type = "backend", this.cdnUrl = t;
|
|
9
|
+
}
|
|
10
|
+
read(t, e, a) {
|
|
11
|
+
fetch(this.cdnUrl + "/translations/" + t.toLowerCase() + ".json").then((r) => {
|
|
12
|
+
if (!r.ok)
|
|
13
|
+
throw new Error("Failed to fetch translations");
|
|
14
|
+
return r.json();
|
|
15
|
+
}).then((r) => {
|
|
16
|
+
a(null, r);
|
|
17
|
+
}).catch(() => {
|
|
18
|
+
a(null, {});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
h as default
|
|
24
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function c() {
|
|
2
|
+
if (console && console.warn) {
|
|
3
|
+
for (var a = arguments.length, e = new Array(a), n = 0; n < a; n++)
|
|
4
|
+
e[n] = arguments[n];
|
|
5
|
+
typeof e[0] == "string" && (e[0] = `react-i18next:: ${e[0]}`), console.warn(...e);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
const u = {};
|
|
9
|
+
function f() {
|
|
10
|
+
for (var a = arguments.length, e = new Array(a), n = 0; n < a; n++)
|
|
11
|
+
e[n] = arguments[n];
|
|
12
|
+
typeof e[0] == "string" && u[e[0]] || (typeof e[0] == "string" && (u[e[0]] = /* @__PURE__ */ new Date()), c(...e));
|
|
13
|
+
}
|
|
14
|
+
const i = (a, e) => () => {
|
|
15
|
+
if (a.isInitialized)
|
|
16
|
+
e();
|
|
17
|
+
else {
|
|
18
|
+
const n = () => {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
a.off("initialized", n);
|
|
21
|
+
}, 0), e();
|
|
22
|
+
};
|
|
23
|
+
a.on("initialized", n);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function h(a, e, n) {
|
|
27
|
+
a.loadNamespaces(e, i(a, n));
|
|
28
|
+
}
|
|
29
|
+
function m(a, e, n, o) {
|
|
30
|
+
typeof n == "string" && (n = [n]), n.forEach((t) => {
|
|
31
|
+
a.options.ns.indexOf(t) < 0 && a.options.ns.push(t);
|
|
32
|
+
}), a.loadLanguages(e, i(a, o));
|
|
33
|
+
}
|
|
34
|
+
function p(a, e) {
|
|
35
|
+
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
36
|
+
const o = e.languages[0], t = e.options ? e.options.fallbackLng : !1, r = e.languages[e.languages.length - 1];
|
|
37
|
+
if (o.toLowerCase() === "cimode")
|
|
38
|
+
return !0;
|
|
39
|
+
const s = (l, d) => {
|
|
40
|
+
const g = e.services.backendConnector.state[`${l}|${d}`];
|
|
41
|
+
return g === -1 || g === 2;
|
|
42
|
+
};
|
|
43
|
+
return n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && e.services.backendConnector.backend && e.isLanguageChangingTo && !s(e.isLanguageChangingTo, a) ? !1 : !!(e.hasResourceBundle(o, a) || !e.services.backendConnector.backend || e.options.resources && !e.options.partialBundledLanguages || s(o, a) && (!t || s(r, a)));
|
|
44
|
+
}
|
|
45
|
+
function b(a, e) {
|
|
46
|
+
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
47
|
+
return !e.languages || !e.languages.length ? (f("i18n.languages were undefined or empty", e.languages), !0) : e.options.ignoreJSONStructure !== void 0 ? e.hasLoadedNamespace(a, {
|
|
48
|
+
lng: n.lng,
|
|
49
|
+
precheck: (t, r) => {
|
|
50
|
+
if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && t.services.backendConnector.backend && t.isLanguageChangingTo && !r(t.isLanguageChangingTo, a))
|
|
51
|
+
return !1;
|
|
52
|
+
}
|
|
53
|
+
}) : p(a, e, n);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
h as a,
|
|
57
|
+
c as b,
|
|
58
|
+
b as h,
|
|
59
|
+
m as l,
|
|
60
|
+
f as w
|
|
61
|
+
};
|