@deriv-com/translations 1.3.8 → 1.3.10

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 +1 @@
1
- export { default as Localize } from "./localize";
1
+ export { default as Localize } from './localize';
@@ -1,8 +1,4 @@
1
- import { default as a } from "./localize.js";
2
- import "../jsx-runtime-ClgrxkDP.js";
3
- import "react";
4
- import "../useTranslation-De5US25M.js";
5
- import "../i18nInstance-D20fwFYr.js";
1
+ import { default as o } from "./localize.js";
6
2
  export {
7
- a as Localize
3
+ o as Localize
8
4
  };
@@ -1,4 +1,5 @@
1
- import type { i18n } from "i18next";
1
+ import { i18n } from 'i18next';
2
+
2
3
  type TLocalizeProps = {
3
4
  i18n_default_text: string;
4
5
  values?: object;
@@ -1,6 +1,6 @@
1
- import { I as W, j as z } from "../jsx-runtime-ClgrxkDP.js";
1
+ import { I as W, j as z } from "../jsx-runtime-BuVcKMXM.js";
2
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-De5US25M.js";
3
+ import { w as Y, a as K, g as Z, u as q } from "../useTranslation-D9WrAGyQ.js";
4
4
  import { g as G, b as S } from "../i18nInstance-D20fwFYr.js";
5
5
  function Q(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -29,13 +29,10 @@ function L(e) {
29
29
  var o = e.indexOf("-->");
30
30
  return { type: "comment", comment: o !== -1 ? e.slice(4, o) : "" };
31
31
  }
32
- for (var p = new RegExp(ne), s = null; (s = p.exec(e)) !== null; )
33
- if (s[0].trim())
34
- if (s[1]) {
35
- var i = s[1].trim(), a = [i, ""];
36
- i.indexOf("=") > -1 && (a = i.split("=")), t.attrs[a[0]] = a[1], p.lastIndex--;
37
- } else
38
- s[2] && (t.attrs[s[2]] = s[3].trim().substring(1, s[3].length - 1));
32
+ for (var p = new RegExp(ne), s = null; (s = p.exec(e)) !== null; ) if (s[0].trim()) if (s[1]) {
33
+ var i = s[1].trim(), a = [i, ""];
34
+ i.indexOf("=") > -1 && (a = i.split("=")), t.attrs[a[0]] = a[1], p.lastIndex--;
35
+ } else s[2] && (t.attrs[s[2]] = s[3].trim().substring(1, s[3].length - 1));
39
36
  return t;
40
37
  }
41
38
  var se = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, re = /^\s*$/, oe = /* @__PURE__ */ Object.create(null);
@@ -46,8 +43,7 @@ function V(e, t) {
46
43
  case "tag":
47
44
  return e += "<" + t.name + (t.attrs ? function(n) {
48
45
  var o = [];
49
- for (var p in n)
50
- o.push(p + '="' + n[p] + '"');
46
+ for (var p in n) o.push(p + '="' + n[p] + '"');
51
47
  return o.length ? " " + o.join(" ") : "";
52
48
  }(t.attrs) : "") + (t.voidElement ? "/>" : ">"), t.voidElement ? e : e + t.children.reduce(V, "") + "</" + t.name + ">";
53
49
  case "comment":
@@ -63,8 +59,7 @@ var ae = { parse: function(e, t) {
63
59
  }
64
60
  return e.replace(se, function(f, c) {
65
61
  if (i) {
66
- if (f !== "</" + n.name + ">")
67
- return;
62
+ if (f !== "</" + n.name + ">") return;
68
63
  i = !1;
69
64
  }
70
65
  var g, j = f.charAt(1) !== "/", E = f.startsWith("<!--"), b = c + f.length, x = e.charAt(b);
@@ -84,14 +79,12 @@ var ae = { parse: function(e, t) {
84
79
  }, "");
85
80
  } };
86
81
  function R(e, t) {
87
- if (!e)
88
- return !1;
82
+ if (!e) return !1;
89
83
  const n = e.props ? e.props.children : e.children;
90
84
  return t ? n.length > 0 : !!n;
91
85
  }
92
86
  function H(e) {
93
- if (!e)
94
- return [];
87
+ if (!e) return [];
95
88
  const t = e.props ? e.props.children : e.children;
96
89
  return e.props && e.props.i18nIsDynamicList ? F(t) : t;
97
90
  }
@@ -108,8 +101,7 @@ function le(e, t) {
108
101
  return n.props = Object.assign(e.props, t.props), n;
109
102
  }
110
103
  function B(e, t) {
111
- if (!e)
112
- return "";
104
+ if (!e) return "";
113
105
  let n = "";
114
106
  const o = F(e), p = t.transSupportBasicHtmlNodes && t.transKeepBasicHtmlNodesFor ? t.transKeepBasicHtmlNodesFor : [];
115
107
  return o.forEach((s, i) => {
@@ -146,11 +138,9 @@ function B(e, t) {
146
138
  }), n;
147
139
  }
148
140
  function pe(e, t, n, o, p, s) {
149
- if (t === "")
150
- return [];
141
+ if (t === "") return [];
151
142
  const i = o.transKeepBasicHtmlNodesFor || [], a = t && new RegExp(i.map((m) => `<${m}`).join("|")).test(t);
152
- if (!e && !a && !s)
153
- return [t];
143
+ if (!e && !a && !s) return [t];
154
144
  const f = {};
155
145
  function c(m) {
156
146
  F(m).forEach((l) => {
@@ -293,8 +283,7 @@ function ue(e) {
293
283
  }, w = r ? m(r, A) : O;
294
284
  c && Object.keys(c).forEach((C) => {
295
285
  const P = c[C];
296
- if (typeof P.type == "function" || !P.props || !P.props.children || w.indexOf(`${C}/>`) < 0 && w.indexOf(`${C} />`) < 0)
297
- return;
286
+ if (typeof P.type == "function" || !P.props || !P.props.children || w.indexOf(`${C}/>`) < 0 && w.indexOf(`${C} />`) < 0) return;
298
287
  function I() {
299
288
  return T(M, null, P);
300
289
  }
@@ -1,4 +1,4 @@
1
- const n = Object.freeze({
1
+ const e = Object.freeze({
2
2
  ACH: "Translations",
3
3
  EN: "English",
4
4
  AR: "العربية",
@@ -18,18 +18,19 @@ const n = Object.freeze({
18
18
  SI: "සිංහල",
19
19
  TH: "ไทย",
20
20
  TR: "Türkçe",
21
+ UZ: "O'zbek",
21
22
  VI: "Tiếng Việt",
22
23
  ZH_CN: "简体中文",
23
24
  ZH_TW: "繁體中文"
24
- }), s = "i18n_language", e = "EN", t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
25
+ }), n = "i18n_language", s = "EN", t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
25
26
  __proto__: null,
26
- ALL_LANGUAGES: n,
27
- DEFAULT_LANGUAGE: e,
28
- LANGUAGE_KEY: s
27
+ ALL_LANGUAGES: e,
28
+ DEFAULT_LANGUAGE: s,
29
+ LANGUAGE_KEY: n
29
30
  }, Symbol.toStringTag, { value: "Module" }));
30
31
  export {
31
- n as A,
32
- e as D,
33
- s as L,
32
+ e as A,
33
+ s as D,
34
+ n as L,
34
35
  t as c
35
36
  };
@@ -108,8 +108,7 @@ function G(i, e, t) {
108
108
  }
109
109
  const r = typeof e != "string" ? [].concat(e) : e.split(".");
110
110
  for (; r.length > 1; ) {
111
- if (s())
112
- return {};
111
+ if (s()) return {};
113
112
  const a = n(r.shift());
114
113
  !i[a] && t && (i[a] = new t()), Object.prototype.hasOwnProperty.call(i, a) ? i = i[a] : i = {};
115
114
  }
@@ -167,8 +166,7 @@ const pe = [" ", ",", "?", "!", ";"];
167
166
  function me(i, e, t) {
168
167
  e = e || "", t = t || "";
169
168
  const n = pe.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
170
- if (n.length === 0)
171
- return !0;
169
+ if (n.length === 0) return !0;
172
170
  const s = new RegExp(`(${n.map((a) => a === "?" ? "\\?" : a).join("|")})`);
173
171
  let r = !s.test(i);
174
172
  if (!r) {
@@ -179,10 +177,8 @@ function me(i, e, t) {
179
177
  }
180
178
  function J(i, e) {
181
179
  let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
182
- if (!i)
183
- return;
184
- if (i[e])
185
- return i[e];
180
+ if (!i) return;
181
+ if (i[e]) return i[e];
186
182
  const n = e.split(t);
187
183
  let s = i;
188
184
  for (let r = 0; r < n.length; ++r) {
@@ -192,15 +188,11 @@ function J(i, e) {
192
188
  let a = 2, l = n.slice(r, r + a).join(t), o = s[l];
193
189
  for (; o === void 0 && n.length > r + a; )
194
190
  a++, l = n.slice(r, r + a).join(t), o = s[l];
195
- if (o === void 0)
196
- return;
197
- if (o === null)
198
- return null;
191
+ if (o === void 0) return;
192
+ if (o === null) return null;
199
193
  if (e.endsWith(l)) {
200
- if (typeof o == "string")
201
- return o;
202
- if (l && typeof o[l] == "string")
203
- return o[l];
194
+ if (typeof o == "string") return o;
195
+ if (l && typeof o[l] == "string") return o[l];
204
196
  }
205
197
  const f = n.slice(r + a).join(t);
206
198
  return f ? J(o, f, t) : void 0;
@@ -339,8 +331,7 @@ class W extends Y {
339
331
  translate(e, t, n) {
340
332
  if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
341
333
  ...t
342
- }), t || (t = {}), e == null)
343
- return "";
334
+ }), t || (t = {}), e == null) return "";
344
335
  Array.isArray(e) || (e = [String(e)]);
345
336
  const s = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, r = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
346
337
  key: a,
@@ -414,8 +405,7 @@ class W extends Y {
414
405
  if (this.options.saveMissingTo === "fallback" && K && K[0])
415
406
  for (let F = 0; F < K.length; F++)
416
407
  j.push(K[F]);
417
- else
418
- this.options.saveMissingTo === "all" ? j = this.languageUtils.toResolveHierarchy(t.lng || this.language) : j.push(t.lng || this.language);
408
+ else this.options.saveMissingTo === "all" ? j = this.languageUtils.toResolveHierarchy(t.lng || this.language) : j.push(t.lng || this.language);
419
409
  const Q = (F, E, X) => {
420
410
  const Z = w && X !== u ? X : b;
421
411
  this.options.missingKeyHandler ? this.options.missingKeyHandler(F, o, E, Z, S, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(F, o, E, Z, S, t), this.emit("missingKey", F, o, E, u);
@@ -479,8 +469,7 @@ class W extends Y {
479
469
  resolve(e) {
480
470
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n, s, r, a, l;
481
471
  return typeof e == "string" && (e = [e]), e.forEach((o) => {
482
- if (this.isValidLookup(n))
483
- return;
472
+ if (this.isValidLookup(n)) return;
484
473
  const f = this.extractFromKey(o, t), g = f.key;
485
474
  s = g;
486
475
  let c = f.namespaces;
@@ -488,8 +477,7 @@ class W extends Y {
488
477
  const u = t.count !== void 0 && typeof t.count != "string", m = u && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), p = t.context !== void 0 && (typeof t.context == "string" || typeof t.context == "number") && t.context !== "", x = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
489
478
  c.forEach((v) => {
490
479
  this.isValidLookup(n) || (l = v, !te[`${x[0]}-${v}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(l) && (te[`${x[0]}-${v}`] = !0, this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), x.forEach((P) => {
491
- if (this.isValidLookup(n))
492
- return;
480
+ if (this.isValidLookup(n)) return;
493
481
  a = P;
494
482
  const O = [g];
495
483
  if (this.i18nFormat && this.i18nFormat.addLookupKeys)
@@ -555,14 +543,12 @@ class ne {
555
543
  this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = k.create("languageUtils");
556
544
  }
557
545
  getScriptPartFromCode(e) {
558
- if (e = z(e), !e || e.indexOf("-") < 0)
559
- return null;
546
+ if (e = z(e), !e || e.indexOf("-") < 0) return null;
560
547
  const t = e.split("-");
561
548
  return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
562
549
  }
563
550
  getLanguagePartFromCode(e) {
564
- if (e = z(e), !e || e.indexOf("-") < 0)
565
- return e;
551
+ if (e = z(e), !e || e.indexOf("-") < 0) return e;
566
552
  const t = e.split("-");
567
553
  return this.formatLanguageCode(t[0]);
568
554
  }
@@ -578,35 +564,27 @@ class ne {
578
564
  return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
579
565
  }
580
566
  getBestMatchFromCodes(e) {
581
- if (!e)
582
- return null;
567
+ if (!e) return null;
583
568
  let t;
584
569
  return e.forEach((n) => {
585
- if (t)
586
- return;
570
+ if (t) return;
587
571
  const s = this.formatLanguageCode(n);
588
572
  (!this.options.supportedLngs || this.isSupportedCode(s)) && (t = s);
589
573
  }), !t && this.options.supportedLngs && e.forEach((n) => {
590
- if (t)
591
- return;
574
+ if (t) return;
592
575
  const s = this.getLanguagePartFromCode(n);
593
- if (this.isSupportedCode(s))
594
- return t = s;
576
+ if (this.isSupportedCode(s)) return t = s;
595
577
  t = this.options.supportedLngs.find((r) => {
596
- if (r === s)
597
- return r;
578
+ if (r === s) return r;
598
579
  if (!(r.indexOf("-") < 0 && s.indexOf("-") < 0) && r.indexOf(s) === 0)
599
580
  return r;
600
581
  });
601
582
  }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
602
583
  }
603
584
  getFallbackCodes(e, t) {
604
- if (!e)
605
- return [];
606
- if (typeof e == "function" && (e = e(t)), typeof e == "string" && (e = [e]), Object.prototype.toString.apply(e) === "[object Array]")
607
- return e;
608
- if (!t)
609
- return e.default || [];
585
+ if (!e) return [];
586
+ if (typeof e == "function" && (e = e(t)), typeof e == "string" && (e = [e]), Object.prototype.toString.apply(e) === "[object Array]") return e;
587
+ if (!t) return e.default || [];
610
588
  let n = e[t];
611
589
  return n || (n = e[this.getScriptPartFromCode(t)]), n || (n = e[this.formatLanguageCode(t)]), n || (n = e[this.getLanguagePartFromCode(t)]), n || (n = e.default), n || [];
612
590
  }
@@ -920,8 +898,7 @@ class Oe {
920
898
  continue;
921
899
  } else
922
900
  this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`), a = "";
923
- else
924
- typeof a != "string" && !this.useRawValueToEscape && (a = q(a));
901
+ else typeof a != "string" && !this.useRawValueToEscape && (a = q(a));
925
902
  const v = p.safeValue(a);
926
903
  if (e = e.replace(r[0], v), u ? (p.regex.lastIndex += a.length, p.regex.lastIndex -= r[0].length) : p.regex.lastIndex = 0, l++, l >= this.maxReplaces)
927
904
  break;
@@ -932,8 +909,7 @@ class Oe {
932
909
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s, r, a;
933
910
  function l(o, f) {
934
911
  const g = this.nestingOptionsSeparator;
935
- if (o.indexOf(g) < 0)
936
- return o;
912
+ if (o.indexOf(g) < 0) return o;
937
913
  const c = o.split(new RegExp(`${g}[ ]*{`));
938
914
  let u = `{${c[1]}`;
939
915
  o = c[0], u = this.interpolate(u, a);
@@ -959,8 +935,7 @@ class Oe {
959
935
  const g = s[1].split(this.formatSeparator).map((c) => c.trim());
960
936
  s[1] = g.shift(), o = g, f = !0;
961
937
  }
962
- if (r = t(l.call(this, s[1].trim(), a), a), r && s[0] === e && typeof r != "string")
963
- return r;
938
+ if (r = t(l.call(this, s[1].trim(), a), a), r && s[0] === e && typeof r != "string") return r;
964
939
  typeof r != "string" && (r = q(r)), r || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), r = ""), f && (r = o.reduce((g, c) => this.format(g, c, n.lng, {
965
940
  ...n,
966
941
  interpolationkey: s[1].trim()
@@ -977,8 +952,7 @@ function we(i) {
977
952
  e = n[0].toLowerCase().trim();
978
953
  const s = n[1].substring(0, n[1].length - 1);
979
954
  e === "currency" && s.indexOf(":") < 0 ? t.currency || (t.currency = s.trim()) : e === "relativetime" && s.indexOf(":") < 0 ? t.range || (t.range = s.trim()) : s.split(";").forEach((a) => {
980
- if (!a)
981
- return;
955
+ if (!a) return;
982
956
  const [l, ...o] = a.split(":"), f = o.join(":").trim().replace(/^'+|'+$/g, "");
983
957
  t[l.trim()] || (t[l.trim()] = f), f === "false" && (t[l.trim()] = !1), f === "true" && (t[l.trim()] = !0), isNaN(f) || (t[l.trim()] = parseInt(f, 10));
984
958
  });
@@ -1116,8 +1090,7 @@ class Re extends Y {
1116
1090
  }
1117
1091
  read(e, t, n) {
1118
1092
  let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0;
1119
- if (!e.length)
1120
- return a(null, {});
1093
+ if (!e.length) return a(null, {});
1121
1094
  if (this.readingCalls >= this.maxParallelReads) {
1122
1095
  this.waitingReads.push({
1123
1096
  lng: e,
@@ -1348,8 +1321,7 @@ class V extends Y {
1348
1321
  const g = (c, u) => {
1349
1322
  this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), o.resolve(u), n(c, u);
1350
1323
  };
1351
- if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized)
1352
- return g(null, this.t.bind(this));
1324
+ if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return g(null, this.t.bind(this));
1353
1325
  this.changeLanguage(this.options.lng, g);
1354
1326
  };
1355
1327
  return this.options.resources || !this.options.initImmediate ? f() : setTimeout(f, 0), o;
@@ -1358,11 +1330,9 @@ class V extends Y {
1358
1330
  let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : U;
1359
1331
  const s = typeof e == "string" ? e : this.language;
1360
1332
  if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
1361
- if (s && s.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0))
1362
- return n();
1333
+ if (s && s.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
1363
1334
  const r = [], a = (l) => {
1364
- if (!l || l === "cimode")
1365
- return;
1335
+ if (!l || l === "cimode") return;
1366
1336
  this.services.languageUtils.toResolveHierarchy(l).forEach((f) => {
1367
1337
  f !== "cimode" && r.indexOf(f) < 0 && r.push(f);
1368
1338
  });
@@ -1380,10 +1350,8 @@ class V extends Y {
1380
1350
  }), s;
1381
1351
  }
1382
1352
  use(e) {
1383
- if (!e)
1384
- throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1385
- if (!e.type)
1386
- throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1353
+ if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1354
+ if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1387
1355
  return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && le.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1388
1356
  }
1389
1357
  setResolvedLanguage(e) {
@@ -1453,16 +1421,14 @@ class V extends Y {
1453
1421
  if (!this.languages || !this.languages.length)
1454
1422
  return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1455
1423
  const n = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
1456
- if (n.toLowerCase() === "cimode")
1457
- return !0;
1424
+ if (n.toLowerCase() === "cimode") return !0;
1458
1425
  const a = (l, o) => {
1459
1426
  const f = this.services.backendConnector.state[`${l}|${o}`];
1460
1427
  return f === -1 || f === 2;
1461
1428
  };
1462
1429
  if (t.precheck) {
1463
1430
  const l = t.precheck(this, a);
1464
- if (l !== void 0)
1465
- return l;
1431
+ if (l !== void 0) return l;
1466
1432
  }
1467
1433
  return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!s || a(r, e)));
1468
1434
  }
@@ -1483,8 +1449,7 @@ class V extends Y {
1483
1449
  }), n) : (t && t(), Promise.resolve());
1484
1450
  }
1485
1451
  dir(e) {
1486
- if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e)
1487
- return "rtl";
1452
+ if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1488
1453
  const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = this.services && this.services.languageUtils || new ne(re());
1489
1454
  return t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1490
1455
  }
@@ -1556,27 +1521,21 @@ var Fe = {};
1556
1521
  var n = t();
1557
1522
  function s(h) {
1558
1523
  var N = 0, d = 0, y = 0, b = typeof Int32Array < "u" ? new Int32Array(4096) : new Array(4096);
1524
+ for (y = 0; y != 256; ++y) b[y] = h[y];
1559
1525
  for (y = 0; y != 256; ++y)
1560
- b[y] = h[y];
1561
- for (y = 0; y != 256; ++y)
1562
- for (d = h[y], N = 256 + y; N < 4096; N += 256)
1563
- d = b[N] = d >>> 8 ^ h[d & 255];
1526
+ for (d = h[y], N = 256 + y; N < 4096; N += 256) d = b[N] = d >>> 8 ^ h[d & 255];
1564
1527
  var S = [];
1565
- for (y = 1; y != 16; ++y)
1566
- S[y - 1] = typeof Int32Array < "u" ? b.subarray(y * 256, y * 256 + 256) : b.slice(y * 256, y * 256 + 256);
1528
+ for (y = 1; y != 16; ++y) S[y - 1] = typeof Int32Array < "u" ? b.subarray(y * 256, y * 256 + 256) : b.slice(y * 256, y * 256 + 256);
1567
1529
  return S;
1568
1530
  }
1569
1531
  var r = s(n), a = r[0], l = r[1], o = r[2], f = r[3], g = r[4], c = r[5], u = r[6], m = r[7], p = r[8], x = r[9], v = r[10], P = r[11], O = r[12], T = r[13], L = r[14];
1570
1532
  function R(h, N) {
1571
- for (var d = N ^ -1, y = 0, b = h.length; y < b; )
1572
- d = d >>> 8 ^ n[(d ^ h.charCodeAt(y++)) & 255];
1533
+ for (var d = N ^ -1, y = 0, b = h.length; y < b; ) d = d >>> 8 ^ n[(d ^ h.charCodeAt(y++)) & 255];
1573
1534
  return ~d;
1574
1535
  }
1575
1536
  function $(h, N) {
1576
- for (var d = N ^ -1, y = h.length - 15, b = 0; b < y; )
1577
- d = L[h[b++] ^ d & 255] ^ T[h[b++] ^ d >> 8 & 255] ^ O[h[b++] ^ d >> 16 & 255] ^ P[h[b++] ^ d >>> 24] ^ v[h[b++]] ^ x[h[b++]] ^ p[h[b++]] ^ m[h[b++]] ^ u[h[b++]] ^ c[h[b++]] ^ g[h[b++]] ^ f[h[b++]] ^ o[h[b++]] ^ l[h[b++]] ^ a[h[b++]] ^ n[h[b++]];
1578
- for (y += 15; b < y; )
1579
- d = d >>> 8 ^ n[(d ^ h[b++]) & 255];
1537
+ for (var d = N ^ -1, y = h.length - 15, b = 0; b < y; ) d = L[h[b++] ^ d & 255] ^ T[h[b++] ^ d >> 8 & 255] ^ O[h[b++] ^ d >> 16 & 255] ^ P[h[b++] ^ d >>> 24] ^ v[h[b++]] ^ x[h[b++]] ^ p[h[b++]] ^ m[h[b++]] ^ u[h[b++]] ^ c[h[b++]] ^ g[h[b++]] ^ f[h[b++]] ^ o[h[b++]] ^ l[h[b++]] ^ a[h[b++]] ^ n[h[b++]];
1538
+ for (y += 15; b < y; ) d = d >>> 8 ^ n[(d ^ h[b++]) & 255];
1580
1539
  return ~d;
1581
1540
  }
1582
1541
  function w(h, N) {
@@ -1 +1 @@
1
- export { default as useTranslations } from "./use-translations";
1
+ export { default as useTranslations } from './use-translations';
@@ -1,11 +1,4 @@
1
- import { default as f } from "./use-translations.js";
2
- import "react";
3
- import "../provider/translation-provider.js";
4
- import "../jsx-runtime-ClgrxkDP.js";
5
- import "../crc32-LCGpXEbE.js";
6
- import "../constants-D-_KboaS.js";
7
- import "../useTranslation-De5US25M.js";
8
- import "../i18nInstance-D20fwFYr.js";
1
+ import { default as e } from "./use-translations.js";
9
2
  export {
10
- f as useTranslations
3
+ e as useTranslations
11
4
  };
@@ -1,7 +1,7 @@
1
1
  export default function useTranslations(): {
2
2
  ready: boolean;
3
3
  localize: (tString: string, values?: Record<string, unknown>) => string;
4
- instance: import("i18next").i18n;
4
+ instance: import('i18next').i18n;
5
5
  switchLanguage: (lang: string) => void;
6
6
  currentLang: string;
7
7
  };
@@ -1,12 +1,9 @@
1
- import { useContext as s } from "react";
1
+ import { useContext as i } from "react";
2
2
  import { TranslationContext as u } from "../provider/translation-provider.js";
3
- import { c } from "../crc32-LCGpXEbE.js";
4
- import { u as l } from "../useTranslation-De5US25M.js";
5
- import "../jsx-runtime-ClgrxkDP.js";
6
- import "../constants-D-_KboaS.js";
7
- import "../i18nInstance-D20fwFYr.js";
8
- function T() {
9
- const t = s(u), { ready: r, t: o, i18n: a } = l(), e = (n, i = {}) => o(c.str(n).toString(), { defaultValue: n, ...i });
3
+ import { c } from "../crc32-DnIYX8GT.js";
4
+ import { u as l } from "../useTranslation-D9WrAGyQ.js";
5
+ function h() {
6
+ const t = i(u), { ready: r, t: a, i18n: o } = l(), e = (n, s = {}) => a(c.str(n).toString(), { defaultValue: n, ...s });
10
7
  if (!t)
11
8
  throw new Error(
12
9
  "useTranslation has to be used within <TranslationContext.Provider>"
@@ -14,11 +11,11 @@ function T() {
14
11
  return {
15
12
  ready: r,
16
13
  localize: e,
17
- instance: a,
14
+ instance: o,
18
15
  switchLanguage: t.switchLanguage,
19
16
  currentLang: t.currentLang
20
17
  };
21
18
  }
22
19
  export {
23
- T as default
20
+ h as default
24
21
  };
package/dist/index.js CHANGED
@@ -1,23 +1,16 @@
1
- import { default as p } from "./utils/initialize-i18n.js";
2
- import { default as s } from "./utils/localize.js";
3
- import { getAllowedLanguages as u, getInitialLanguage as x, loadIncontextTranslation as g } from "./utils/lang-utils.js";
4
- import { default as z } from "./components/localize.js";
5
- import { default as L } from "./hooks/use-translations.js";
6
- import { default as v } from "./provider/translation-provider.js";
7
- import "./crc32-LCGpXEbE.js";
8
- import "./utils/otasdk.js";
9
- import "./i18nInstance-D20fwFYr.js";
10
- import "./constants-D-_KboaS.js";
11
- import "./jsx-runtime-ClgrxkDP.js";
12
- import "react";
13
- import "./useTranslation-De5US25M.js";
1
+ import { default as o } from "./utils/initialize-i18n.js";
2
+ import { default as r } from "./utils/localize.js";
3
+ import { getAllowedLanguages as n, getInitialLanguage as i, loadIncontextTranslation as f } from "./utils/lang-utils.js";
4
+ import { default as d } from "./components/localize.js";
5
+ import { default as x } from "./hooks/use-translations.js";
6
+ import { default as m } from "./provider/translation-provider.js";
14
7
  export {
15
- z as Localize,
16
- v as TranslationProvider,
17
- u as getAllowedLanguages,
18
- x as getInitialLanguage,
19
- p as initializeI18n,
20
- g as loadIncontextTranslation,
21
- s as localize,
22
- L as useTranslations
8
+ d as Localize,
9
+ m as TranslationProvider,
10
+ n as getAllowedLanguages,
11
+ i as getInitialLanguage,
12
+ o as initializeI18n,
13
+ f as loadIncontextTranslation,
14
+ r as localize,
15
+ x as useTranslations
23
16
  };
@@ -25,18 +25,14 @@ var H = { exports: {} }, k = {};
25
25
  */
26
26
  var ye;
27
27
  function ur() {
28
- if (ye)
29
- return k;
28
+ if (ye) return k;
30
29
  ye = 1;
31
30
  var F = Oe, E = Symbol.for("react.element"), y = Symbol.for("react.fragment"), T = Object.prototype.hasOwnProperty, A = F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, I = { key: !0, ref: !0, __self: !0, __source: !0 };
32
31
  function w(b, l, O) {
33
32
  var v, g = {}, R = null, $ = null;
34
33
  O !== void 0 && (R = "" + O), l.key !== void 0 && (R = "" + l.key), l.ref !== void 0 && ($ = l.ref);
35
- for (v in l)
36
- T.call(l, v) && !I.hasOwnProperty(v) && (g[v] = l[v]);
37
- if (b && b.defaultProps)
38
- for (v in l = b.defaultProps, l)
39
- g[v] === void 0 && (g[v] = l[v]);
34
+ for (v in l) T.call(l, v) && !I.hasOwnProperty(v) && (g[v] = l[v]);
35
+ if (b && b.defaultProps) for (v in l = b.defaultProps, l) g[v] === void 0 && (g[v] = l[v]);
40
36
  return { $$typeof: E, type: b, key: R, ref: $, props: g, _owner: A.current };
41
37
  }
42
38
  return k.Fragment = y, k.jsx = w, k.jsxs = w, k;
@@ -1,2 +1,2 @@
1
- export * from "./translation-provider";
2
- export { default as TranslationProvider } from "./translation-provider";
1
+ export * from './translation-provider';
2
+ export { default as TranslationProvider } from './translation-provider';
@@ -1,9 +1,5 @@
1
- import { TranslationContext as n, default as p } from "./translation-provider.js";
2
- import "../jsx-runtime-ClgrxkDP.js";
3
- import "react";
4
- import "../crc32-LCGpXEbE.js";
5
- import "../constants-D-_KboaS.js";
1
+ import { TranslationContext as r, default as t } from "./translation-provider.js";
6
2
  export {
7
- n as TranslationContext,
8
- p as TranslationProvider
3
+ r as TranslationContext,
4
+ t as TranslationProvider
9
5
  };
@@ -1,6 +1,7 @@
1
1
  import { constants } from '../utils/index';
2
- import type { i18n as Ti18n } from "i18next";
3
- export declare const TranslationContext: import("react").Context<{
2
+ import { i18n as Ti18n } from 'i18next';
3
+
4
+ export declare const TranslationContext: import('react').Context<{
4
5
  currentLang: string;
5
6
  switchLanguage: (lang: string) => void;
6
7
  } | null>;
@@ -1,7 +1,7 @@
1
- import { I as f, j as s } from "../jsx-runtime-ClgrxkDP.js";
1
+ import { I as f, j as s } from "../jsx-runtime-BuVcKMXM.js";
2
2
  import { useMemo as g, createElement as m, createContext as d, useState as i, useEffect as x } from "react";
3
- import "../crc32-LCGpXEbE.js";
4
- import { L } from "../constants-D-_KboaS.js";
3
+ import "../crc32-DnIYX8GT.js";
4
+ import { L } from "../constants-BypKaLtI.js";
5
5
  function p(t) {
6
6
  let {
7
7
  i18n: e,
@@ -1,5 +1,5 @@
1
1
  import { useContext as P, useState as $, useRef as w, useEffect as x } from "react";
2
- import { I as k, R as A } from "./jsx-runtime-ClgrxkDP.js";
2
+ import { I as k, R as A } from "./jsx-runtime-BuVcKMXM.js";
3
3
  import { g as E, b as F } from "./i18nInstance-D20fwFYr.js";
4
4
  function j() {
5
5
  if (console && console.warn) {
@@ -37,8 +37,7 @@ function R(n, e, a, f) {
37
37
  function U(n, e) {
38
38
  let a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
39
39
  const f = e.languages[0], o = e.options ? e.options.fallbackLng : !1, t = e.languages[e.languages.length - 1];
40
- if (f.toLowerCase() === "cimode")
41
- return !0;
40
+ if (f.toLowerCase() === "cimode") return !0;
42
41
  const g = (y, b) => {
43
42
  const r = e.services.backendConnector.state[`${y}|${b}`];
44
43
  return r === -1 || r === 2;
@@ -50,8 +49,7 @@ function B(n, e) {
50
49
  return !e.languages || !e.languages.length ? (I("i18n.languages were undefined or empty", e.languages), !0) : e.options.ignoreJSONStructure !== void 0 ? e.hasLoadedNamespace(n, {
51
50
  lng: a.lng,
52
51
  precheck: (o, t) => {
53
- if (a.bindI18n && a.bindI18n.indexOf("languageChanging") > -1 && o.services.backendConnector.backend && o.isLanguageChangingTo && !t(o.isLanguageChangingTo, n))
54
- return !1;
52
+ if (a.bindI18n && a.bindI18n.indexOf("languageChanging") > -1 && o.services.backendConnector.backend && o.isLanguageChangingTo && !t(o.isLanguageChangingTo, n)) return !1;
55
53
  }
56
54
  }) : U(n, e, a);
57
55
  }
@@ -118,8 +116,7 @@ function Y(n) {
118
116
  d.current && !C.current && m(p), C.current = !1;
119
117
  }, [t, b]);
120
118
  const N = [L, t, l];
121
- if (N.t = L, N.i18n = t, N.ready = l, l || !l && !y)
122
- return N;
119
+ if (N.t = L, N.i18n = t, N.ready = l, l || !l && !y) return N;
123
120
  throw new Promise((s) => {
124
121
  e.lng ? R(t, e.lng, r, () => s()) : v(t, r, () => s());
125
122
  });
@@ -18,6 +18,7 @@ export declare const ALL_LANGUAGES: Readonly<{
18
18
  SI: "සිංහල";
19
19
  TH: "ไทย";
20
20
  TR: "Türkçe";
21
+ UZ: "O'zbek";
21
22
  VI: "Tiếng Việt";
22
23
  ZH_CN: "简体中文";
23
24
  ZH_TW: "繁體中文";
@@ -1,4 +1,4 @@
1
- import { A as G, D as E, L as U } from "../constants-D-_KboaS.js";
1
+ import { A as G, D as E, L as U } from "../constants-BypKaLtI.js";
2
2
  export {
3
3
  G as ALL_LANGUAGES,
4
4
  E as DEFAULT_LANGUAGE,
@@ -1,5 +1,5 @@
1
- export { default as initializeI18n } from "./initialize-i18n";
2
- export { default as localize } from "./localize";
3
- export { default as OtaSdk } from "./otasdk";
4
- export * as constants from "./constants";
5
- export * from "./lang-utils";
1
+ export { default as initializeI18n } from './initialize-i18n';
2
+ export { default as localize } from './localize';
3
+ export { default as OtaSdk } from './otasdk';
4
+ export * as constants from './constants';
5
+ export * from './lang-utils';
@@ -1,16 +1,14 @@
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 m } from "../constants-D-_KboaS.js";
1
+ import { default as e } from "./initialize-i18n.js";
2
+ import { default as l } from "./localize.js";
3
+ import { default as r } from "./otasdk.js";
4
+ import { c as i } from "../constants-BypKaLtI.js";
5
5
  import { getAllowedLanguages as d, getInitialLanguage as g, loadIncontextTranslation as x } from "./lang-utils.js";
6
- import "../crc32-LCGpXEbE.js";
7
- import "../i18nInstance-D20fwFYr.js";
8
6
  export {
9
- f as OtaSdk,
10
- m as constants,
7
+ r as OtaSdk,
8
+ i as constants,
11
9
  d as getAllowedLanguages,
12
10
  g as getInitialLanguage,
13
- r as initializeI18n,
11
+ e as initializeI18n,
14
12
  x as loadIncontextTranslation,
15
- n as localize
13
+ l as localize
16
14
  };
@@ -1,9 +1,10 @@
1
- import { InitOptions } from "i18next";
1
+ import { InitOptions } from 'i18next';
2
+
2
3
  type TInstanceConfig = {
3
4
  useSuspense?: Exclude<InitOptions["react"], undefined>["useSuspense"];
4
5
  enableDebug?: InitOptions["debug"];
5
6
  };
6
7
  export default function initializeI18n({ cdnUrl, useSuspense, enableDebug, }: {
7
8
  cdnUrl: string;
8
- } & TInstanceConfig): import("i18next").i18n;
9
+ } & TInstanceConfig): import('i18next').i18n;
9
10
  export {};
@@ -1,8 +1,7 @@
1
- import { i, c as o } from "../crc32-LCGpXEbE.js";
1
+ import { i as a, c as o } from "../crc32-DnIYX8GT.js";
2
2
  import c from "./otasdk.js";
3
3
  import { getInitialLanguage as l } from "./lang-utils.js";
4
4
  import { s as u, a as f } from "../i18nInstance-D20fwFYr.js";
5
- import "../constants-D-_KboaS.js";
6
5
  const m = {
7
6
  type: "3rdParty",
8
7
  init(t) {
@@ -22,14 +21,14 @@ const m = {
22
21
  escapeValue: !1
23
22
  }
24
23
  });
25
- function b({
24
+ function y({
26
25
  cdnUrl: t,
27
26
  useSuspense: e = !0,
28
27
  enableDebug: n = !1
29
28
  }) {
30
- const a = new c(t), r = l(), s = g({ useSuspense: e, enableDebug: n });
31
- return i.use(a).use(m).init({ ...s, lng: r }), i;
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;
32
31
  }
33
32
  export {
34
- b as default
33
+ y as default
35
34
  };
@@ -1,4 +1,5 @@
1
1
  import { constants } from './index';
2
+
2
3
  type LanguageCode = keyof typeof constants.ALL_LANGUAGES;
3
4
  export declare const getInitialLanguage: () => any;
4
5
  export declare const loadIncontextTranslation: (lang: LanguageCode) => void;
@@ -1,5 +1,5 @@
1
- import "../crc32-LCGpXEbE.js";
2
- import { L as s, D as c, A as o } from "../constants-D-_KboaS.js";
1
+ import "../crc32-DnIYX8GT.js";
2
+ import { L as s, D as c, A as o } from "../constants-BypKaLtI.js";
3
3
  const p = () => {
4
4
  const a = new URLSearchParams(window.location.search).get("lang");
5
5
  let t = localStorage.getItem(s) ?? '"EN"';
@@ -1,4 +1,4 @@
1
- import { i as e, c as r } from "../crc32-LCGpXEbE.js";
1
+ import { i as e, c as r } from "../crc32-DnIYX8GT.js";
2
2
  function o(t, a) {
3
3
  return t ? e.t(r.str(t).toString(), {
4
4
  defaultValue: t,
@@ -1,4 +1,5 @@
1
- import { ModuleType } from "i18next";
1
+ import { ModuleType } from 'i18next';
2
+
2
3
  interface OtaI18nextModule {
3
4
  cdnUrl: string;
4
5
  type: ModuleType;
@@ -1,6 +1,6 @@
1
1
  var o = Object.defineProperty;
2
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);
3
+ var s = (n, t, e) => c(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  class h {
5
5
  constructor(t) {
6
6
  s(this, "type");
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "deriv-extract-translations": "./dist/deriv-extract-translations.cjs"
11
11
  },
12
12
  "private": false,
13
- "version": "1.3.8",
13
+ "version": "1.3.10",
14
14
  "scripts": {
15
15
  "dev": "vite",
16
16
  "build": "tsc && vite build && cp ./src/scripts/deriv-extract-translations.cjs ./dist/deriv-extract-translations.cjs",
@@ -48,7 +48,7 @@
48
48
  "typescript": "^5.2.2",
49
49
  "vite": "^5.0.8",
50
50
  "vite-plugin-dts": "^3.7.3",
51
- "vitest": "^1.3.1"
51
+ "vitest": "^1.6.1"
52
52
  },
53
53
  "optionalDependencies": {
54
54
  "@rollup/rollup-linux-x64-gnu": "^4.17.1"