@deriv-com/translations 1.0.0 → 1.0.1
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/components/index.js +3 -3
- package/dist/components/localize.js +3 -3
- package/dist/{crc32-bHbojQDz.js → crc32-LCGpXEbE.js} +1 -1
- package/{scripts/extract-translations.js → dist/extract-translations.cjs} +0 -11
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/use-translations.js +20 -20
- package/dist/index.js +5 -5
- package/dist/provider/index.js +3 -3
- package/dist/provider/translation-provider.js +3 -3
- package/dist/utils/constants.js +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/initialize-i18n.js +3 -3
- package/dist/utils/lang-utils.js +2 -2
- package/dist/utils/localize.js +1 -1
- package/package.json +4 -4
- /package/dist/{constants-XUr5oono.js → constants-C3Rdpvgf.js} +0 -0
- /package/dist/{context-NlNsLXrG.js → context-f4Bcf4Hs.js} +0 -0
- /package/dist/{i18nInstance-I4t--qpO.js → i18nInstance-D20fwFYr.js} +0 -0
- /package/dist/{utils-L82GdMuf.js → utils-6G1tiZlP.js} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as e } from "./localize.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../utils-
|
|
5
|
-
import "../i18nInstance-
|
|
6
|
-
import "../context-
|
|
4
|
+
import "../utils-6G1tiZlP.js";
|
|
5
|
+
import "../i18nInstance-D20fwFYr.js";
|
|
6
|
+
import "../context-f4Bcf4Hs.js";
|
|
7
7
|
export {
|
|
8
8
|
e as Localize
|
|
9
9
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as z } from "react/jsx-runtime";
|
|
2
2
|
import { createElement as T, isValidElement as K, Fragment as M, cloneElement as _, Children as J, useContext as U } from "react";
|
|
3
|
-
import { w as X, b as H } from "../utils-
|
|
4
|
-
import { g as Y, b as I } from "../i18nInstance-
|
|
5
|
-
import { I as Z } from "../context-
|
|
3
|
+
import { w as X, b as H } from "../utils-6G1tiZlP.js";
|
|
4
|
+
import { g as Y, b as I } from "../i18nInstance-D20fwFYr.js";
|
|
5
|
+
import { I as Z } from "../context-f4Bcf4Hs.js";
|
|
6
6
|
function q(t) {
|
|
7
7
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
8
8
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const program = require("commander");
|
|
6
5
|
const crc32 = require("crc-32").str;
|
|
7
6
|
const fs = require("fs");
|
|
8
7
|
const glob = require("glob");
|
|
@@ -75,12 +74,6 @@ const getTranslatableFiles = () => {
|
|
|
75
74
|
return file_paths;
|
|
76
75
|
};
|
|
77
76
|
|
|
78
|
-
program
|
|
79
|
-
.version("0.1.0")
|
|
80
|
-
.description("Build translation source.")
|
|
81
|
-
.option("-v, --verbose", "Displays the list of paths to be compiled")
|
|
82
|
-
.parse(process.argv);
|
|
83
|
-
|
|
84
77
|
/** *********************************************
|
|
85
78
|
* Common
|
|
86
79
|
*/
|
|
@@ -100,10 +93,6 @@ const getKeyHash = (string) => crc32(string);
|
|
|
100
93
|
const file_path = file_paths[i];
|
|
101
94
|
|
|
102
95
|
try {
|
|
103
|
-
if (program.verbose) {
|
|
104
|
-
console.log(file_path);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
96
|
const file = fs.readFileSync(file_path, "utf8");
|
|
108
97
|
messages.push(
|
|
109
98
|
...(file_path.endsWith("xml")
|
package/dist/hooks/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import { default as l } from "./use-translations.js";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import "../provider/translation-provider.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
|
-
import "../crc32-
|
|
6
|
-
import "../constants-
|
|
7
|
-
import "../context-
|
|
8
|
-
import "../utils-
|
|
9
|
-
import "../i18nInstance-
|
|
5
|
+
import "../crc32-LCGpXEbE.js";
|
|
6
|
+
import "../constants-C3Rdpvgf.js";
|
|
7
|
+
import "../context-f4Bcf4Hs.js";
|
|
8
|
+
import "../utils-6G1tiZlP.js";
|
|
9
|
+
import "../i18nInstance-D20fwFYr.js";
|
|
10
10
|
export {
|
|
11
11
|
l as useTranslations
|
|
12
12
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { useContext as P, useState as E, useRef as N, useEffect as w } from "react";
|
|
2
2
|
import { TranslationContext as F } from "../provider/translation-provider.js";
|
|
3
|
-
import { c as j } from "../crc32-
|
|
4
|
-
import { I as v, R as z } from "../context-
|
|
5
|
-
import { w as R, h as A, l as C, a as L } from "../utils-
|
|
6
|
-
import { g as M, b as U } from "../i18nInstance-
|
|
3
|
+
import { c as j } from "../crc32-LCGpXEbE.js";
|
|
4
|
+
import { I as v, R as z } from "../context-f4Bcf4Hs.js";
|
|
5
|
+
import { w as R, h as A, l as C, a as L } from "../utils-6G1tiZlP.js";
|
|
6
|
+
import { g as M, b as U } from "../i18nInstance-D20fwFYr.js";
|
|
7
7
|
import "react/jsx-runtime";
|
|
8
|
-
import "../constants-
|
|
8
|
+
import "../constants-C3Rdpvgf.js";
|
|
9
9
|
const $ = (a, t) => {
|
|
10
|
-
const
|
|
10
|
+
const u = N();
|
|
11
11
|
return w(() => {
|
|
12
|
-
|
|
13
|
-
}, [a, t]),
|
|
12
|
+
u.current = a;
|
|
13
|
+
}, [a, t]), u.current;
|
|
14
14
|
};
|
|
15
15
|
function J(a) {
|
|
16
16
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
17
17
|
const {
|
|
18
|
-
i18n:
|
|
18
|
+
i18n: u
|
|
19
19
|
} = t, {
|
|
20
20
|
i18n: y,
|
|
21
21
|
defaultNS: h
|
|
22
|
-
} = P(v) || {}, e =
|
|
22
|
+
} = P(v) || {}, e = u || y || U();
|
|
23
23
|
if (e && !e.reportNamespaces && (e.reportNamespaces = new z()), !e) {
|
|
24
24
|
R("You will need to pass in an i18next instance by using initReactI18next");
|
|
25
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];
|
|
@@ -34,7 +34,7 @@ function J(a) {
|
|
|
34
34
|
useSuspense: x,
|
|
35
35
|
keyPrefix: S
|
|
36
36
|
} = f;
|
|
37
|
-
let n =
|
|
37
|
+
let n = h || e.options && e.options.defaultNS;
|
|
38
38
|
n = typeof n == "string" ? [n] : n || ["translation"], e.reportNamespaces.addUsedNamespaces && e.reportNamespaces.addUsedNamespaces(n);
|
|
39
39
|
const l = (e.isInitialized || e.initializedStoreOnce) && n.every((r) => A(r, e, f));
|
|
40
40
|
function d() {
|
|
@@ -43,27 +43,27 @@ function J(a) {
|
|
|
43
43
|
const [b, p] = E(d);
|
|
44
44
|
let m = n.join();
|
|
45
45
|
t.lng && (m = `${t.lng}${m}`);
|
|
46
|
-
const I = $(m),
|
|
46
|
+
const I = $(m), c = N(!0);
|
|
47
47
|
w(() => {
|
|
48
48
|
const {
|
|
49
49
|
bindI18n: r,
|
|
50
50
|
bindI18nStore: o
|
|
51
51
|
} = f;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
c.current = !0, !l && !x && (t.lng ? C(e, t.lng, n, () => {
|
|
53
|
+
c.current && p(d);
|
|
54
54
|
}) : L(e, n, () => {
|
|
55
|
-
|
|
56
|
-
})), l && I && I !== m &&
|
|
55
|
+
c.current && p(d);
|
|
56
|
+
})), l && I && I !== m && c.current && p(d);
|
|
57
57
|
function i() {
|
|
58
|
-
|
|
58
|
+
c.current && p(d);
|
|
59
59
|
}
|
|
60
60
|
return r && e && e.on(r, i), o && e && e.store.on(o, i), () => {
|
|
61
|
-
|
|
61
|
+
c.current = !1, r && e && r.split(" ").forEach((s) => e.off(s, i)), o && e && o.split(" ").forEach((s) => e.store.off(s, i));
|
|
62
62
|
};
|
|
63
63
|
}, [e, m]);
|
|
64
64
|
const T = N(!0);
|
|
65
65
|
w(() => {
|
|
66
|
-
|
|
66
|
+
c.current && !T.current && p(d), T.current = !1;
|
|
67
67
|
}, [e, S]);
|
|
68
68
|
const g = [b, e, l];
|
|
69
69
|
if (g.t = b, g.i18n = e, g.ready = l, l || !l && !x)
|
|
@@ -73,7 +73,7 @@ function J(a) {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function X() {
|
|
76
|
-
const a = P(F), { ready: t, t:
|
|
76
|
+
const a = P(F), { ready: t, t: u, i18n: y } = J(), h = (e, f = {}) => u(j.str(e).toString(), { defaultValue: e, ...f });
|
|
77
77
|
if (!a)
|
|
78
78
|
throw new Error(
|
|
79
79
|
"useTranslation has to be used within <TranslationContext.Provider>"
|
package/dist/index.js
CHANGED
|
@@ -4,14 +4,14 @@ import { getInitialLanguage as x, loadIncontextTranslation as c } from "./utils/
|
|
|
4
4
|
import { default as z } from "./components/localize.js";
|
|
5
5
|
import { default as T } from "./hooks/use-translations.js";
|
|
6
6
|
import { default as v } from "./provider/translation-provider.js";
|
|
7
|
-
import "./crc32-
|
|
7
|
+
import "./crc32-LCGpXEbE.js";
|
|
8
8
|
import "./utils/otasdk.js";
|
|
9
|
-
import "./i18nInstance-
|
|
10
|
-
import "./constants-
|
|
9
|
+
import "./i18nInstance-D20fwFYr.js";
|
|
10
|
+
import "./constants-C3Rdpvgf.js";
|
|
11
11
|
import "react/jsx-runtime";
|
|
12
12
|
import "react";
|
|
13
|
-
import "./utils-
|
|
14
|
-
import "./context-
|
|
13
|
+
import "./utils-6G1tiZlP.js";
|
|
14
|
+
import "./context-f4Bcf4Hs.js";
|
|
15
15
|
export {
|
|
16
16
|
z as Localize,
|
|
17
17
|
v as TranslationProvider,
|
package/dist/provider/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TranslationContext as n, default as e } from "./translation-provider.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../crc32-
|
|
5
|
-
import "../constants-
|
|
6
|
-
import "../context-
|
|
4
|
+
import "../crc32-LCGpXEbE.js";
|
|
5
|
+
import "../constants-C3Rdpvgf.js";
|
|
6
|
+
import "../context-f4Bcf4Hs.js";
|
|
7
7
|
export {
|
|
8
8
|
n as TranslationContext,
|
|
9
9
|
e as TranslationProvider
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as f, createElement as c, createContext as g, useState as u, useEffect as m } from "react";
|
|
3
|
-
import "../crc32-
|
|
4
|
-
import { L } from "../constants-
|
|
5
|
-
import { I as p } from "../context-
|
|
3
|
+
import "../crc32-LCGpXEbE.js";
|
|
4
|
+
import { L } from "../constants-C3Rdpvgf.js";
|
|
5
|
+
import { I as p } from "../context-f4Bcf4Hs.js";
|
|
6
6
|
function v(a) {
|
|
7
7
|
let {
|
|
8
8
|
i18n: e,
|
package/dist/utils/constants.js
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { default as r } from "./initialize-i18n.js";
|
|
2
2
|
import { default as n } from "./localize.js";
|
|
3
3
|
import { default as f } from "./otasdk.js";
|
|
4
|
-
import { c as p } from "../constants-
|
|
4
|
+
import { c as p } from "../constants-C3Rdpvgf.js";
|
|
5
5
|
import { getInitialLanguage as x, loadIncontextTranslation as d } from "./lang-utils.js";
|
|
6
|
-
import "../crc32-
|
|
7
|
-
import "../i18nInstance-
|
|
6
|
+
import "../crc32-LCGpXEbE.js";
|
|
7
|
+
import "../i18nInstance-D20fwFYr.js";
|
|
8
8
|
export {
|
|
9
9
|
f as OtaSdk,
|
|
10
10
|
p as constants,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as e, c as i } from "../crc32-
|
|
1
|
+
import { i as e, c as i } from "../crc32-LCGpXEbE.js";
|
|
2
2
|
import s from "./otasdk.js";
|
|
3
3
|
import { getInitialLanguage as r } from "./lang-utils.js";
|
|
4
|
-
import { s as o, a as u } from "../i18nInstance-
|
|
5
|
-
import "../constants-
|
|
4
|
+
import { s as o, a as u } from "../i18nInstance-D20fwFYr.js";
|
|
5
|
+
import "../constants-C3Rdpvgf.js";
|
|
6
6
|
const c = {
|
|
7
7
|
type: "3rdParty",
|
|
8
8
|
init(t) {
|
package/dist/utils/lang-utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../crc32-
|
|
2
|
-
import { L as n, D as o } from "../constants-
|
|
1
|
+
import "../crc32-LCGpXEbE.js";
|
|
2
|
+
import { L as n, D as o } from "../constants-C3Rdpvgf.js";
|
|
3
3
|
const i = () => {
|
|
4
4
|
const e = new URLSearchParams(window.location.search).get("lang"), t = localStorage.getItem(n);
|
|
5
5
|
if (e) {
|
package/dist/utils/localize.js
CHANGED
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"bin": {
|
|
10
|
-
"extract-translations": "./
|
|
10
|
+
"extract-translations": "./dist/extract-translations.cjs"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"private": false,
|
|
19
|
-
"version": "1.0.
|
|
19
|
+
"version": "1.0.1",
|
|
20
20
|
"scripts": {
|
|
21
21
|
"dev": "vite",
|
|
22
|
-
"build": "tsc && vite build",
|
|
22
|
+
"build": "tsc && vite build && cp ./src/scripts/extract-translations.cjs ./dist/extract-translations.cjs",
|
|
23
23
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
24
24
|
"test": "vitest ./src/__tests__/*.test.tsx",
|
|
25
25
|
"prepublish": "npm run test && npm run build"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"eslint": "^8.55.0",
|
|
49
49
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
50
50
|
"eslint-plugin-react-refresh": "^0.4.5",
|
|
51
|
-
"glob": "^10.3.
|
|
51
|
+
"glob": "^10.3.12",
|
|
52
52
|
"i18next": "^23.7.18",
|
|
53
53
|
"jsdom": "^24.0.0",
|
|
54
54
|
"react": "^18.2.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|