@deriv-com/translations 1.3.11 → 1.4.0

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.
@@ -1,5 +1,4 @@
1
1
  import { i18n } from 'i18next';
2
-
3
2
  type TLocalizeProps = {
4
3
  i18n_default_text: string;
5
4
  values?: object;
@@ -1,42 +1,46 @@
1
- import { I as W, j as z } from "../jsx-runtime-BuVcKMXM.js";
2
- import { createElement as T, isValidElement as D, Fragment as M, cloneElement as _, Children as J, useContext as U, forwardRef as X } from "react";
3
- import { w as Y, a as K, g as Z, u as q } from "../useTranslation-D9WrAGyQ.js";
4
- import { g as G, b as S } from "../i18nInstance-D20fwFYr.js";
5
- function Q(e) {
1
+ import { I as M, j as q } from "../jsx-runtime-oIKL5WiM.js";
2
+ import { createElement as T, isValidElement as D, Fragment as _, cloneElement as J, Children as U, useContext as X, forwardRef as Y } from "react";
3
+ import { w as Z, a as V, g as G, u as Q } from "../useTranslation-CZfO55Z-.js";
4
+ import { g as B, b as ee } from "../i18nInstance-D3STmr24.js";
5
+ function te(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
7
  }
8
- var ee = {
9
- area: !0,
10
- base: !0,
11
- br: !0,
12
- col: !0,
13
- embed: !0,
14
- hr: !0,
15
- img: !0,
16
- input: !0,
17
- link: !0,
18
- meta: !0,
19
- param: !0,
20
- source: !0,
21
- track: !0,
22
- wbr: !0
23
- };
24
- const te = /* @__PURE__ */ Q(ee);
25
- var ne = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
26
- function L(e) {
8
+ var I, L;
9
+ function ne() {
10
+ return L || (L = 1, I = {
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
+ }), 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) {
27
31
  var t = { type: "tag", name: "", voidElement: !1, attrs: {}, children: [] }, n = e.match(/<\/?([^\s]+?)[/\s>]/);
28
- if (n && (t.name = n[1], (te[n[1]] || e.charAt(e.length - 2) === "/") && (t.voidElement = !0), t.name.startsWith("!--"))) {
32
+ if (n && (t.name = n[1], (re[n[1]] || e.charAt(e.length - 2) === "/") && (t.voidElement = !0), t.name.startsWith("!--"))) {
29
33
  var o = e.indexOf("-->");
30
34
  return { type: "comment", comment: o !== -1 ? e.slice(4, o) : "" };
31
35
  }
32
- for (var p = new RegExp(ne), s = null; (s = p.exec(e)) !== null; ) if (s[0].trim()) if (s[1]) {
36
+ for (var p = new RegExp(oe), s = null; (s = p.exec(e)) !== null; ) if (s[0].trim()) if (s[1]) {
33
37
  var i = s[1].trim(), a = [i, ""];
34
38
  i.indexOf("=") > -1 && (a = i.split("=")), t.attrs[a[0]] = a[1], p.lastIndex--;
35
39
  } else s[2] && (t.attrs[s[2]] = s[3].trim().substring(1, s[3].length - 1));
36
40
  return t;
37
41
  }
38
- var se = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, re = /^\s*$/, oe = /* @__PURE__ */ Object.create(null);
39
- function V(e, t) {
42
+ var ae = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, ie = /^\s*$/, le = /* @__PURE__ */ Object.create(null);
43
+ function W(e, t) {
40
44
  switch (t.type) {
41
45
  case "text":
42
46
  return e + t.content;
@@ -45,40 +49,40 @@ function V(e, t) {
45
49
  var o = [];
46
50
  for (var p in n) o.push(p + '="' + n[p] + '"');
47
51
  return o.length ? " " + o.join(" ") : "";
48
- }(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(V, "") + "</" + t.name + ">";
52
+ }(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(W, "") + "</" + t.name + ">";
49
53
  case "comment":
50
54
  return e + "<!--" + t.comment + "-->";
51
55
  }
52
56
  }
53
- var ae = { parse: function(e, t) {
54
- t || (t = {}), t.components || (t.components = oe);
57
+ var pe = { parse: function(e, t) {
58
+ t || (t = {}), t.components || (t.components = le);
55
59
  var n, o = [], p = [], s = -1, i = !1;
56
60
  if (e.indexOf("<") !== 0) {
57
61
  var a = e.indexOf("<");
58
62
  o.push({ type: "text", content: a === -1 ? e : e.substring(0, a) });
59
63
  }
60
- return e.replace(se, function(f, c) {
64
+ return e.replace(ae, function(f, c) {
61
65
  if (i) {
62
66
  if (f !== "</" + n.name + ">") return;
63
67
  i = !1;
64
68
  }
65
- var g, j = f.charAt(1) !== "/", E = f.startsWith("<!--"), b = c + f.length, x = e.charAt(b);
66
- if (E) {
67
- var y = L(f);
68
- return s < 0 ? (o.push(y), o) : ((g = p[s]).children.push(y), o);
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);
69
73
  }
70
- if (j && (s++, (n = L(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), (!j || n.voidElement) && (s > -1 && (n.voidElement || n.name === f.slice(2, -1)) && (s--, n = s === -1 ? o : p[s]), !i && x !== "<" && x)) {
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)) {
71
75
  g = s === -1 ? o : p[s].children;
72
76
  var m = e.indexOf("<", b), u = e.slice(b, m === -1 ? void 0 : m);
73
- re.test(u) && (u = " "), (m > -1 && s + g.length >= 0 || u !== " ") && g.push({ type: "text", content: u });
77
+ ie.test(u) && (u = " "), (m > -1 && s + g.length >= 0 || u !== " ") && g.push({ type: "text", content: u });
74
78
  }
75
79
  }), o;
76
80
  }, stringify: function(e) {
77
81
  return e.reduce(function(t, n) {
78
- return t + V("", n);
82
+ return t + W("", n);
79
83
  }, "");
80
84
  } };
81
- function R(e, t) {
85
+ function K(e, t) {
82
86
  if (!e) return !1;
83
87
  const n = e.props ? e.props.children : e.children;
84
88
  return t ? n.length > 0 : !!n;
@@ -88,19 +92,19 @@ function H(e) {
88
92
  const t = e.props ? e.props.children : e.children;
89
93
  return e.props && e.props.i18nIsDynamicList ? F(t) : t;
90
94
  }
91
- function ie(e) {
95
+ function ue(e) {
92
96
  return Object.prototype.toString.call(e) !== "[object Array]" ? !1 : e.every((t) => D(t));
93
97
  }
94
98
  function F(e) {
95
99
  return Array.isArray(e) ? e : [e];
96
100
  }
97
- function le(e, t) {
101
+ function ce(e, t) {
98
102
  const n = {
99
103
  ...t
100
104
  };
101
105
  return n.props = Object.assign(e.props, t.props), n;
102
106
  }
103
- function B(e, t) {
107
+ function z(e, t) {
104
108
  if (!e) return "";
105
109
  let n = "";
106
110
  const o = F(e), p = t.transSupportBasicHtmlNodes && t.transKeepBasicHtmlNodesFor ? t.transKeepBasicHtmlNodesFor : [];
@@ -118,11 +122,11 @@ function B(e, t) {
118
122
  else if (f && a === 1 && typeof c == "string")
119
123
  n += `<${s.type}>${c}</${s.type}>`;
120
124
  else {
121
- const g = B(c, t);
125
+ const g = z(c, t);
122
126
  n += `<${i}>${g}</${i}>`;
123
127
  }
124
128
  } else if (s === null)
125
- K("Trans: the passed in value is invalid - seems you passed in a null child.");
129
+ V("Trans: the passed in value is invalid - seems you passed in a null child.");
126
130
  else if (typeof s == "object") {
127
131
  const {
128
132
  format: a,
@@ -132,105 +136,105 @@ function B(e, t) {
132
136
  const g = a ? `${c[0]}, ${a}` : c[0];
133
137
  n += `{{${g}}}`;
134
138
  } else
135
- K("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", s);
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);
136
140
  } else
137
- K("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);
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);
138
142
  }), n;
139
143
  }
140
- function pe(e, t, n, o, p, s) {
144
+ function fe(e, t, n, o, p, s) {
141
145
  if (t === "") return [];
142
146
  const i = o.transKeepBasicHtmlNodesFor || [], a = t && new RegExp(i.map((m) => `<${m}`).join("|")).test(t);
143
147
  if (!e && !a && !s) return [t];
144
148
  const f = {};
145
149
  function c(m) {
146
150
  F(m).forEach((l) => {
147
- typeof l != "string" && (R(l) ? c(H(l)) : typeof l == "object" && !D(l) && Object.assign(f, l));
151
+ typeof l != "string" && (K(l) ? c(H(l)) : typeof l == "object" && !D(l) && Object.assign(f, l));
148
152
  });
149
153
  }
150
154
  c(e);
151
- const g = ae.parse(`<0>${t}</0>`), j = {
155
+ const g = pe.parse(`<0>${t}</0>`), E = {
152
156
  ...f,
153
157
  ...p
154
158
  };
155
- function E(m, u, l) {
159
+ function j(m, u, l) {
156
160
  const v = H(m), O = x(v, u.children, l);
157
- return ie(v) && O.length === 0 || m.props && m.props.i18nIsDynamicList ? v : O;
161
+ return ue(v) && O.length === 0 || m.props && m.props.i18nIsDynamicList ? v : O;
158
162
  }
159
163
  function b(m, u, l, v, O) {
160
- m.dummy ? (m.children = u, l.push(_(m, {
164
+ m.dummy ? (m.children = u, l.push(J(m, {
161
165
  key: v
162
- }, O ? void 0 : u))) : l.push(...J.map([m], (h) => {
166
+ }, O ? void 0 : u))) : l.push(...U.map([m], (y) => {
163
167
  const r = {
164
- ...h.props
168
+ ...y.props
165
169
  };
166
- return delete r.i18nIsDynamicList, T(h.type, {
170
+ return delete r.i18nIsDynamicList, T(y.type, {
167
171
  ...r,
168
172
  key: v,
169
- ref: h.ref
173
+ ref: y.ref
170
174
  }, O ? null : u);
171
175
  }));
172
176
  }
173
177
  function x(m, u, l) {
174
178
  const v = F(m);
175
- return F(u).reduce((h, r, k) => {
176
- const A = r.children && r.children[0] && r.children[0].content && n.services.interpolator.interpolate(r.children[0].content, j, n.language);
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);
177
181
  if (r.type === "tag") {
178
182
  let w = v[parseInt(r.name, 10)];
179
183
  l.length === 1 && !w && (w = l[0][r.name]), w || (w = {});
180
- const d = Object.keys(r.attrs).length !== 0 ? le({
184
+ const d = Object.keys(r.attrs).length !== 0 ? ce({
181
185
  props: r.attrs
182
- }, w) : w, N = D(d), C = N && R(r, !0) && !r.voidElement, P = a && typeof d == "object" && d.dummy && !N, I = typeof e == "object" && e !== null && Object.hasOwnProperty.call(e, r.name);
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);
183
187
  if (typeof d == "string") {
184
- const $ = n.services.interpolator.interpolate(d, j, n.language);
185
- h.push($);
186
- } else if (R(d) || C) {
187
- const $ = E(d, r, l);
188
- b(d, $, h, k);
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);
189
193
  } else if (P) {
190
194
  const $ = x(v, r.children, l);
191
- b(d, $, h, k);
195
+ b(d, $, y, k);
192
196
  } else if (Number.isNaN(parseFloat(r.name)))
193
- if (I) {
194
- const $ = E(d, r, l);
195
- b(d, $, h, k, r.voidElement);
197
+ if (R) {
198
+ const $ = j(d, r, l);
199
+ b(d, $, y, k, r.voidElement);
196
200
  } else if (o.transSupportBasicHtmlNodes && i.indexOf(r.name) > -1)
197
201
  if (r.voidElement)
198
- h.push(T(r.name, {
202
+ y.push(T(r.name, {
199
203
  key: `${r.name}-${k}`
200
204
  }));
201
205
  else {
202
206
  const $ = x(v, r.children, l);
203
- h.push(T(r.name, {
207
+ y.push(T(r.name, {
204
208
  key: `${r.name}-${k}`
205
209
  }, $));
206
210
  }
207
211
  else if (r.voidElement)
208
- h.push(`<${r.name} />`);
212
+ y.push(`<${r.name} />`);
209
213
  else {
210
214
  const $ = x(v, r.children, l);
211
- h.push(`<${r.name}>${$}</${r.name}>`);
215
+ y.push(`<${r.name}>${$}</${r.name}>`);
212
216
  }
213
217
  else if (typeof d == "object" && !N) {
214
218
  const $ = r.children[0] ? A : null;
215
- $ && h.push($);
219
+ $ && y.push($);
216
220
  } else
217
- b(d, A, h, k, r.children.length !== 1 || !A);
221
+ b(d, A, y, k, r.children.length !== 1 || !A);
218
222
  } else if (r.type === "text") {
219
- const w = o.transWrapTextNodes, d = s ? o.unescape(n.services.interpolator.interpolate(r.content, j, n.language)) : n.services.interpolator.interpolate(r.content, j, n.language);
220
- w ? h.push(T(w, {
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, {
221
225
  key: `${r.name}-${k}`
222
- }, d)) : h.push(d);
226
+ }, d)) : y.push(d);
223
227
  }
224
- return h;
228
+ return y;
225
229
  }, []);
226
230
  }
227
- const y = x([{
231
+ const h = x([{
228
232
  dummy: !0,
229
233
  children: e || []
230
234
  }], g, F(e || []));
231
- return H(y[0]);
235
+ return H(h[0]);
232
236
  }
233
- function ue(e) {
237
+ function me(e) {
234
238
  let {
235
239
  children: t,
236
240
  count: n,
@@ -242,30 +246,30 @@ function ue(e) {
242
246
  defaults: f,
243
247
  components: c,
244
248
  ns: g,
245
- i18n: j,
246
- t: E,
249
+ i18n: E,
250
+ t: j,
247
251
  shouldUnescape: b,
248
252
  ...x
249
253
  } = e;
250
- const y = j || S();
251
- if (!y)
252
- return Y("You will need to pass in an i18next instance by using i18nextReactModule"), t;
253
- const m = E || y.t.bind(y) || ((C) => C);
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);
254
258
  s && (i.context = s);
255
259
  const u = {
256
- ...G(),
257
- ...y.options && y.options.react
260
+ ...ee(),
261
+ ...h.options && h.options.react
258
262
  };
259
- let l = g || m.ns || y.options && y.options.defaultNS;
263
+ let l = g || m.ns || h.options && h.options.defaultNS;
260
264
  l = typeof l == "string" ? [l] : l || ["translation"];
261
- const v = B(t, u), O = f || v || u.transEmptyNodeValue || p, {
262
- hashTransKey: h
263
- } = u, r = p || (h ? h(v || O) : v || O);
264
- y.options && y.options.interpolation && y.options.interpolation.defaultVariables && (a = a && Object.keys(a).length > 0 ? {
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 ? {
265
269
  ...a,
266
- ...y.options.interpolation.defaultVariables
270
+ ...h.options.interpolation.defaultVariables
267
271
  } : {
268
- ...y.options.interpolation.defaultVariables
272
+ ...h.options.interpolation.defaultVariables
269
273
  });
270
274
  const k = a ? i.interpolation : {
271
275
  interpolation: {
@@ -284,15 +288,15 @@ function ue(e) {
284
288
  c && Object.keys(c).forEach((C) => {
285
289
  const P = c[C];
286
290
  if (typeof P.type == "function" || !P.props || !P.props.children || w.indexOf(`${C}/>`) < 0 && w.indexOf(`${C} />`) < 0) return;
287
- function I() {
288
- return T(M, null, P);
291
+ function R() {
292
+ return T(_, null, P);
289
293
  }
290
- c[C] = T(I);
294
+ c[C] = T(R);
291
295
  });
292
- const d = pe(c || t, w, y, u, A, b), N = o !== void 0 ? o : u.defaultTransParent;
296
+ const d = fe(c || t, w, h, u, A, b), N = o !== void 0 ? o : u.defaultTransParent;
293
297
  return N ? T(N, x, d) : d;
294
298
  }
295
- function ce(e) {
299
+ function he(e) {
296
300
  let {
297
301
  children: t,
298
302
  count: n,
@@ -304,16 +308,16 @@ function ce(e) {
304
308
  defaults: f,
305
309
  components: c,
306
310
  ns: g,
307
- i18n: j,
308
- t: E,
311
+ i18n: E,
312
+ t: j,
309
313
  shouldUnescape: b,
310
314
  ...x
311
315
  } = e;
312
316
  const {
313
- i18n: y,
317
+ i18n: h,
314
318
  defaultNS: m
315
- } = U(W) || {}, u = j || y || S(), l = E || u && u.t.bind(u);
316
- return ue({
319
+ } = X(M) || {}, u = E || h || B(), l = j || u && u.t.bind(u);
320
+ return me({
317
321
  children: t,
318
322
  count: n,
319
323
  parent: o,
@@ -325,12 +329,12 @@ function ce(e) {
325
329
  components: c,
326
330
  ns: g || l && l.ns || m || u && u.options && u.options.defaultNS,
327
331
  i18n: u,
328
- t: E,
332
+ t: j,
329
333
  shouldUnescape: b,
330
334
  ...x
331
335
  });
332
336
  }
333
- function fe(e) {
337
+ function ye(e) {
334
338
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
335
339
  return function(o) {
336
340
  function p(i) {
@@ -338,25 +342,25 @@ function fe(e) {
338
342
  forwardedRef: a,
339
343
  ...f
340
344
  } = i;
341
- const [c, g, j] = q(e, {
345
+ const [c, g, E] = Q(e, {
342
346
  ...f,
343
347
  keyPrefix: t.keyPrefix
344
- }), E = {
348
+ }), j = {
345
349
  ...f,
346
350
  t: c,
347
351
  i18n: g,
348
- tReady: j
352
+ tReady: E
349
353
  };
350
- return t.withRef && a ? E.ref = a : !t.withRef && a && (E.forwardedRef = a), T(o, E);
354
+ return t.withRef && a ? j.ref = a : !t.withRef && a && (j.forwardedRef = a), T(o, j);
351
355
  }
352
- p.displayName = `withI18nextTranslation(${Z(o)})`, p.WrappedComponent = o;
356
+ p.displayName = `withI18nextTranslation(${G(o)})`, p.WrappedComponent = o;
353
357
  const s = (i, a) => T(p, Object.assign({}, i, {
354
358
  forwardedRef: a
355
359
  }));
356
- return t.withRef ? X(s) : p;
360
+ return t.withRef ? Y(s) : p;
357
361
  };
358
362
  }
359
- function me({
363
+ function de({
360
364
  i18n: e,
361
365
  i18n_default_text: t,
362
366
  values: n,
@@ -364,8 +368,8 @@ function me({
364
368
  options: p,
365
369
  shouldUnescape: s
366
370
  }) {
367
- return /* @__PURE__ */ z.jsx(
368
- ce,
371
+ return /* @__PURE__ */ q.jsx(
372
+ he,
369
373
  {
370
374
  defaults: t,
371
375
  i18n: e,
@@ -376,7 +380,7 @@ function me({
376
380
  }
377
381
  );
378
382
  }
379
- const ve = fe()(me);
383
+ const $e = ye()(de);
380
384
  export {
381
- ve as default
385
+ $e as default
382
386
  };
@@ -9,6 +9,7 @@ const e = Object.freeze({
9
9
  ID: "Indonesian",
10
10
  IT: "Italiano",
11
11
  SW: "Kiswahili",
12
+ TA: "தமிழ்",
12
13
  KM: "ខ្មែរ",
13
14
  KO: "한국어",
14
15
  MN: "Монгол",