@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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 deriv.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # `@deriv-com/translations`
2
+
3
+ This is a localization library that uses `i18next`, `react-i18next`, and a custom OTA SDK for translations.
4
+
5
+ **In this document**
6
+
7
+ - [Overview](#overview)
8
+ - [Requirements](#requirements)
9
+ - [Setup](#setup)
10
+ - [Usage](#usage)
11
+ - [`initializeI18n`](#initializei18n)
12
+ - [`<Localize />`](#localize-component-example)
13
+ - [~~`localize`~~](#localize-example)
14
+ - [`useTranslations` Hook](#usetranslations-hook)
15
+ - [Syncing translations to CDN](#syncing-translations)
16
+ - [Contributing](#contributing)
17
+
18
+ ## Overview
19
+
20
+ ![image](https://github.com/amir-deriv/translations/assets/129206554/e303f0cb-e15f-41e9-92ad-f930e43c484b)
21
+
22
+
23
+ ## Requirements
24
+
25
+ The stored translation directory must have the following structure:
26
+ `{{ BASE_URL }}/translations/{lang}.json`
27
+
28
+ base_url is the cdnUrl passed to the `initializeI18n` function, and lang is the language code. Refer to the [example](#initializei18n)
29
+
30
+ ## Getting Started
31
+
32
+ Install the package by running:
33
+
34
+ ```bash
35
+ npm install @deriv-com/translations
36
+ ```
37
+
38
+ ### Setup
39
+
40
+ - initialize translations in main component by importing and calling `initializeI18n` outside of the component function
41
+ - pass the return value to the `TranslationProvider` component from `@deriv-com/translations`.
42
+ - pass default language to the `TranslationProvider` component.
43
+
44
+ ```jsx
45
+ import { initializeI18n, TranslationProvider } from '@deriv/translations';
46
+ ...
47
+ const i18nInstance = initializeI18n({ cdnUrl: 'https://cdn.example.com' })
48
+
49
+ const App = () => {
50
+ ...
51
+ return (
52
+ <TranslationProvider defaultLang={'EN'} i18nInstance={i18nInstance}>
53
+ <App />
54
+ </TranslationProvider>
55
+ )
56
+ }
57
+
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ ### `initializeI18n`
63
+
64
+ The `initializeI18n` function initializes the `i18next` instance with the OTA SDK, `react-i18next`, and a language detector. It takes an object with a cdnUrl property, which is the URL of the CDN where the translations are stored.
65
+
66
+ ```javascript
67
+ import initializeI18n from "@deriv-com/translations";
68
+
69
+ initializeI18n({ cdnUrl: "https://cdn.example.com" });
70
+ ```
71
+
72
+ - For strings use either `localize(...)` or `<Localize />`
73
+
74
+ ### `Localize` component example:
75
+
76
+ ```jsx
77
+ import { Localize } from "@deriv-com/translations";
78
+
79
+ <Localize
80
+ i18n_default_text="You cannot use your real money account with {{website_name}} at this time."
81
+ values={{ website_name }}
82
+ />;
83
+ ```
84
+
85
+ ### ~~`localize`~~ example:
86
+
87
+ > Note that the `localize` function is deprecated and should be replaced with the `useTranslations` hook or the `Localize` component. the example of the `localize` function is provided for backward compatibility.
88
+
89
+ ```jsx
90
+ import { localize } from "@deriv-com/translations";
91
+
92
+ <h4 className="drawer__notifications-header">
93
+ {localize("all notifications")}
94
+ </h4>;
95
+ ```
96
+
97
+ ### `useTranslations` Hook
98
+
99
+ The useTranslations hook is a custom hook that adds some more returned values on top of the `useTranslation` hook from `react-i18next`. It can be used to translate strings in your components, toggle the language of the app and see the current language etc.
100
+
101
+ Example usage:
102
+
103
+ ```javascript
104
+ import { useTranslations } from "@username/package";
105
+
106
+ const MyComponent = () => {
107
+ const { localize, switchLanguage, currentLang } = useTranslations();
108
+
109
+ const handleLanguageChange = () => {
110
+ switchLanguage(currentLang === "EN" ? "DE" : "EN");
111
+ };
112
+
113
+ return <p onClick={handleLanguageChange}>{localize("Change language")}</p>;
114
+ };
115
+ ```
116
+
117
+ ## Syncing translations
118
+
119
+ There is a github action that syncs the translations from Crowdin to the CDN.
120
+
121
+ The action takes following inputs:
122
+
123
+ - `CROWDIN_BRANCH_NAME`: Running on production, test or staging etc
124
+ - `CROWDIN_PROJECT_ID`: Crowdin project ID which can be found in the crowdin project settings
125
+ - `CROWDIN_PERSONAL_TOKEN`: Crowdin personal token which can be found in the crowdin account settings
126
+ - `R2_ACCOUNT_ID`: R2 account ID from the Cloudflare R2 dashboard
127
+ - `R2_ACCESS_KEY_ID`: R2 access key ID from the Cloudflare R2 dashboard
128
+ - `R2_SECRET_ACCESS_KEY`: R2 secret access key from the Cloudflare R2 dashboard
129
+ - `R2_BUCKET_NAME`: R2 bucket name from the Cloudflare R2 dashboard
130
+
131
+ Refer to the action file [here](https://github.com/deriv-com/shared-actions/blob/master/.github/actions/sync_crowdin_translation_with_cloudflare/action.yml)
132
+
133
+ ## Contributing
134
+
135
+ Contributions are welcome. Please open a pull request with your changes.
@@ -0,0 +1 @@
1
+ export { default as Localize } from "./localize";
@@ -0,0 +1,9 @@
1
+ import { default as e } from "./localize.js";
2
+ import "react/jsx-runtime";
3
+ import "react";
4
+ import "../utils-L82GdMuf.js";
5
+ import "../i18nInstance-I4t--qpO.js";
6
+ import "../context-NlNsLXrG.js";
7
+ export {
8
+ e as Localize
9
+ };
@@ -0,0 +1,9 @@
1
+ type TLocalizeProps = {
2
+ i18n_default_text: string;
3
+ values?: object;
4
+ components?: JSX.Element[];
5
+ options?: Record<string, unknown>;
6
+ shouldUnescape?: boolean;
7
+ };
8
+ export default function Localize({ i18n_default_text, values, components, options, shouldUnescape, }: TLocalizeProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,365 @@
1
+ import { jsx as z } from "react/jsx-runtime";
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-L82GdMuf.js";
4
+ import { g as Y, b as I } from "../i18nInstance-I4t--qpO.js";
5
+ import { I as Z } from "../context-NlNsLXrG.js";
6
+ function q(t) {
7
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
8
+ }
9
+ var G = {
10
+ area: !0,
11
+ base: !0,
12
+ br: !0,
13
+ col: !0,
14
+ embed: !0,
15
+ hr: !0,
16
+ img: !0,
17
+ input: !0,
18
+ link: !0,
19
+ meta: !0,
20
+ param: !0,
21
+ source: !0,
22
+ track: !0,
23
+ wbr: !0
24
+ };
25
+ const Q = /* @__PURE__ */ q(G);
26
+ var R = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
27
+ function B(t) {
28
+ var e = { type: "tag", name: "", voidElement: !1, attrs: {}, children: [] }, n = t.match(/<\/?([^\s]+?)[/\s>]/);
29
+ if (n && (e.name = n[1], (Q[n[1]] || t.charAt(t.length - 2) === "/") && (e.voidElement = !0), e.name.startsWith("!--"))) {
30
+ var o = t.indexOf("-->");
31
+ return { type: "comment", comment: o !== -1 ? t.slice(4, o) : "" };
32
+ }
33
+ for (var c = new RegExp(R), s = null; (s = c.exec(t)) !== null; )
34
+ if (s[0].trim())
35
+ if (s[1]) {
36
+ var l = s[1].trim(), p = [l, ""];
37
+ l.indexOf("=") > -1 && (p = l.split("=")), e.attrs[p[0]] = p[1], c.lastIndex--;
38
+ } else
39
+ s[2] && (e.attrs[s[2]] = s[3].trim().substring(1, s[3].length - 1));
40
+ return e;
41
+ }
42
+ var tt = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, et = /^\s*$/, nt = /* @__PURE__ */ Object.create(null);
43
+ function L(t, e) {
44
+ switch (e.type) {
45
+ case "text":
46
+ return t + e.content;
47
+ case "tag":
48
+ return t += "<" + e.name + (e.attrs ? function(n) {
49
+ var o = [];
50
+ for (var c in n)
51
+ o.push(c + '="' + n[c] + '"');
52
+ return o.length ? " " + o.join(" ") : "";
53
+ }(e.attrs) : "") + (e.voidElement ? "/>" : ">"), e.voidElement ? t : t + e.children.reduce(L, "") + "</" + e.name + ">";
54
+ case "comment":
55
+ return t + "<!--" + e.comment + "-->";
56
+ }
57
+ }
58
+ var st = { parse: function(t, e) {
59
+ e || (e = {}), e.components || (e.components = nt);
60
+ var n, o = [], c = [], s = -1, l = !1;
61
+ if (t.indexOf("<") !== 0) {
62
+ var p = t.indexOf("<");
63
+ o.push({ type: "text", content: p === -1 ? t : t.substring(0, p) });
64
+ }
65
+ return t.replace(tt, function(m, f) {
66
+ if (l) {
67
+ if (m !== "</" + n.name + ">")
68
+ return;
69
+ l = !1;
70
+ }
71
+ var v, E = m.charAt(1) !== "/", k = m.startsWith("<!--"), b = f + m.length, $ = t.charAt(b);
72
+ if (k) {
73
+ var y = B(m);
74
+ return s < 0 ? (o.push(y), o) : ((v = c[s]).children.push(y), o);
75
+ }
76
+ if (E && (s++, (n = B(m)).type === "tag" && e.components[n.name] && (n.type = "component", l = !0), n.voidElement || l || !$ || $ === "<" || n.children.push({ type: "text", content: t.slice(b, t.indexOf("<", b)) }), s === 0 && o.push(n), (v = c[s - 1]) && v.children.push(n), c[s] = n), (!E || n.voidElement) && (s > -1 && (n.voidElement || n.name === m.slice(2, -1)) && (s--, n = s === -1 ? o : c[s]), !l && $ !== "<" && $)) {
77
+ v = s === -1 ? o : c[s].children;
78
+ var u = t.indexOf("<", b), i = t.slice(b, u === -1 ? void 0 : u);
79
+ et.test(i) && (i = " "), (u > -1 && s + v.length >= 0 || i !== " ") && v.push({ type: "text", content: i });
80
+ }
81
+ }), o;
82
+ }, stringify: function(t) {
83
+ return t.reduce(function(e, n) {
84
+ return e + L("", n);
85
+ }, "");
86
+ } };
87
+ function S(t, e) {
88
+ if (!t)
89
+ return !1;
90
+ const n = t.props ? t.props.children : t.children;
91
+ return e ? n.length > 0 : !!n;
92
+ }
93
+ function V(t) {
94
+ if (!t)
95
+ return [];
96
+ const e = t.props ? t.props.children : t.children;
97
+ return t.props && t.props.i18nIsDynamicList ? P(e) : e;
98
+ }
99
+ function rt(t) {
100
+ return Object.prototype.toString.call(t) !== "[object Array]" ? !1 : t.every((e) => K(e));
101
+ }
102
+ function P(t) {
103
+ return Array.isArray(t) ? t : [t];
104
+ }
105
+ function ot(t, e) {
106
+ const n = {
107
+ ...e
108
+ };
109
+ return n.props = Object.assign(t.props, e.props), n;
110
+ }
111
+ function W(t, e) {
112
+ if (!t)
113
+ return "";
114
+ let n = "";
115
+ const o = P(t), c = e.transSupportBasicHtmlNodes && e.transKeepBasicHtmlNodesFor ? e.transKeepBasicHtmlNodesFor : [];
116
+ return o.forEach((s, l) => {
117
+ if (typeof s == "string")
118
+ n += `${s}`;
119
+ else if (K(s)) {
120
+ const p = Object.keys(s.props).length, m = c.indexOf(s.type) > -1, f = s.props.children;
121
+ if (!f && m && p === 0)
122
+ n += `<${s.type}/>`;
123
+ else if (!f && (!m || p !== 0))
124
+ n += `<${l}></${l}>`;
125
+ else if (s.props.i18nIsDynamicList)
126
+ n += `<${l}></${l}>`;
127
+ else if (m && p === 1 && typeof f == "string")
128
+ n += `<${s.type}>${f}</${s.type}>`;
129
+ else {
130
+ const v = W(f, e);
131
+ n += `<${l}>${v}</${l}>`;
132
+ }
133
+ } else if (s === null)
134
+ H("Trans: the passed in value is invalid - seems you passed in a null child.");
135
+ else if (typeof s == "object") {
136
+ const {
137
+ format: p,
138
+ ...m
139
+ } = s, f = Object.keys(m);
140
+ if (f.length === 1) {
141
+ const v = p ? `${f[0]}, ${p}` : f[0];
142
+ n += `{{${v}}}`;
143
+ } else
144
+ H("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", s);
145
+ } else
146
+ H("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);
147
+ }), n;
148
+ }
149
+ function at(t, e, n, o, c, s) {
150
+ if (e === "")
151
+ return [];
152
+ const l = o.transKeepBasicHtmlNodesFor || [], p = e && new RegExp(l.map((u) => `<${u}`).join("|")).test(e);
153
+ if (!t && !p && !s)
154
+ return [e];
155
+ const m = {};
156
+ function f(u) {
157
+ P(u).forEach((a) => {
158
+ typeof a != "string" && (S(a) ? f(V(a)) : typeof a == "object" && !K(a) && Object.assign(m, a));
159
+ });
160
+ }
161
+ f(t);
162
+ const v = st.parse(`<0>${e}</0>`), E = {
163
+ ...m,
164
+ ...c
165
+ };
166
+ function k(u, i, a) {
167
+ const g = V(u), O = $(g, i.children, a);
168
+ return rt(g) && O.length === 0 || u.props && u.props.i18nIsDynamicList ? g : O;
169
+ }
170
+ function b(u, i, a, g, O) {
171
+ u.dummy ? (u.children = i, a.push(_(u, {
172
+ key: g
173
+ }, O ? void 0 : i))) : a.push(...J.map([u], (h) => {
174
+ const r = {
175
+ ...h.props
176
+ };
177
+ return delete r.i18nIsDynamicList, T(h.type, {
178
+ ...r,
179
+ key: g,
180
+ ref: h.ref
181
+ }, O ? null : i);
182
+ }));
183
+ }
184
+ function $(u, i, a) {
185
+ const g = P(u);
186
+ return P(i).reduce((h, r, C) => {
187
+ const N = r.children && r.children[0] && r.children[0].content && n.services.interpolator.interpolate(r.children[0].content, E, n.language);
188
+ if (r.type === "tag") {
189
+ let j = g[parseInt(r.name, 10)];
190
+ a.length === 1 && !j && (j = a[0][r.name]), j || (j = {});
191
+ const d = Object.keys(r.attrs).length !== 0 ? ot({
192
+ props: r.attrs
193
+ }, j) : j, w = K(d), A = w && S(r, !0) && !r.voidElement, F = p && typeof d == "object" && d.dummy && !w, D = typeof t == "object" && t !== null && Object.hasOwnProperty.call(t, r.name);
194
+ if (typeof d == "string") {
195
+ const x = n.services.interpolator.interpolate(d, E, n.language);
196
+ h.push(x);
197
+ } else if (S(d) || A) {
198
+ const x = k(d, r, a);
199
+ b(d, x, h, C);
200
+ } else if (F) {
201
+ const x = $(g, r.children, a);
202
+ b(d, x, h, C);
203
+ } else if (Number.isNaN(parseFloat(r.name)))
204
+ if (D) {
205
+ const x = k(d, r, a);
206
+ b(d, x, h, C, r.voidElement);
207
+ } else if (o.transSupportBasicHtmlNodes && l.indexOf(r.name) > -1)
208
+ if (r.voidElement)
209
+ h.push(T(r.name, {
210
+ key: `${r.name}-${C}`
211
+ }));
212
+ else {
213
+ const x = $(g, r.children, a);
214
+ h.push(T(r.name, {
215
+ key: `${r.name}-${C}`
216
+ }, x));
217
+ }
218
+ else if (r.voidElement)
219
+ h.push(`<${r.name} />`);
220
+ else {
221
+ const x = $(g, r.children, a);
222
+ h.push(`<${r.name}>${x}</${r.name}>`);
223
+ }
224
+ else if (typeof d == "object" && !w) {
225
+ const x = r.children[0] ? N : null;
226
+ x && h.push(x);
227
+ } else
228
+ b(d, N, h, C, r.children.length !== 1 || !N);
229
+ } else if (r.type === "text") {
230
+ const j = o.transWrapTextNodes, d = s ? o.unescape(n.services.interpolator.interpolate(r.content, E, n.language)) : n.services.interpolator.interpolate(r.content, E, n.language);
231
+ j ? h.push(T(j, {
232
+ key: `${r.name}-${C}`
233
+ }, d)) : h.push(d);
234
+ }
235
+ return h;
236
+ }, []);
237
+ }
238
+ const y = $([{
239
+ dummy: !0,
240
+ children: t || []
241
+ }], v, P(t || []));
242
+ return V(y[0]);
243
+ }
244
+ function it(t) {
245
+ let {
246
+ children: e,
247
+ count: n,
248
+ parent: o,
249
+ i18nKey: c,
250
+ context: s,
251
+ tOptions: l = {},
252
+ values: p,
253
+ defaults: m,
254
+ components: f,
255
+ ns: v,
256
+ i18n: E,
257
+ t: k,
258
+ shouldUnescape: b,
259
+ ...$
260
+ } = t;
261
+ const y = E || I();
262
+ if (!y)
263
+ return X("You will need to pass in an i18next instance by using i18nextReactModule"), e;
264
+ const u = k || y.t.bind(y) || ((A) => A);
265
+ s && (l.context = s);
266
+ const i = {
267
+ ...Y(),
268
+ ...y.options && y.options.react
269
+ };
270
+ let a = v || u.ns || y.options && y.options.defaultNS;
271
+ a = typeof a == "string" ? [a] : a || ["translation"];
272
+ const g = W(e, i), O = m || g || i.transEmptyNodeValue || c, {
273
+ hashTransKey: h
274
+ } = i, r = c || (h ? h(g || O) : g || O);
275
+ y.options && y.options.interpolation && y.options.interpolation.defaultVariables && (p = p && Object.keys(p).length > 0 ? {
276
+ ...p,
277
+ ...y.options.interpolation.defaultVariables
278
+ } : {
279
+ ...y.options.interpolation.defaultVariables
280
+ });
281
+ const C = p ? l.interpolation : {
282
+ interpolation: {
283
+ ...l.interpolation,
284
+ prefix: "#$?",
285
+ suffix: "?$#"
286
+ }
287
+ }, N = {
288
+ ...l,
289
+ count: n,
290
+ ...p,
291
+ ...C,
292
+ defaultValue: O,
293
+ ns: a
294
+ }, j = r ? u(r, N) : O;
295
+ f && Object.keys(f).forEach((A) => {
296
+ const F = f[A];
297
+ if (typeof F.type == "function" || !F.props || !F.props.children || j.indexOf(`${A}/>`) < 0 && j.indexOf(`${A} />`) < 0)
298
+ return;
299
+ function D() {
300
+ return T(M, null, F);
301
+ }
302
+ f[A] = T(D);
303
+ });
304
+ const d = at(f || e, j, y, i, N, b), w = o !== void 0 ? o : i.defaultTransParent;
305
+ return w ? T(w, $, d) : d;
306
+ }
307
+ function lt(t) {
308
+ let {
309
+ children: e,
310
+ count: n,
311
+ parent: o,
312
+ i18nKey: c,
313
+ context: s,
314
+ tOptions: l = {},
315
+ values: p,
316
+ defaults: m,
317
+ components: f,
318
+ ns: v,
319
+ i18n: E,
320
+ t: k,
321
+ shouldUnescape: b,
322
+ ...$
323
+ } = t;
324
+ const {
325
+ i18n: y,
326
+ defaultNS: u
327
+ } = U(Z) || {}, i = E || y || I(), a = k || i && i.t.bind(i);
328
+ return it({
329
+ children: e,
330
+ count: n,
331
+ parent: o,
332
+ i18nKey: c,
333
+ context: s,
334
+ tOptions: l,
335
+ values: p,
336
+ defaults: m,
337
+ components: f,
338
+ ns: v || a && a.ns || u || i && i.options && i.options.defaultNS,
339
+ i18n: i,
340
+ t: k,
341
+ shouldUnescape: b,
342
+ ...$
343
+ });
344
+ }
345
+ function yt({
346
+ i18n_default_text: t,
347
+ values: e,
348
+ components: n,
349
+ options: o,
350
+ shouldUnescape: c
351
+ }) {
352
+ return /* @__PURE__ */ z(
353
+ lt,
354
+ {
355
+ defaults: t,
356
+ values: e,
357
+ components: n,
358
+ tOptions: o,
359
+ shouldUnescape: c
360
+ }
361
+ );
362
+ }
363
+ export {
364
+ yt as default
365
+ };
@@ -0,0 +1,29 @@
1
+ const n = Object.freeze({
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
+ }), e = "i18n_language", s = "EN", t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19
+ __proto__: null,
20
+ ALL_LANGUAGES: n,
21
+ DEFAULT_LANGUAGE: s,
22
+ LANGUAGE_KEY: e
23
+ }, Symbol.toStringTag, { value: "Module" }));
24
+ export {
25
+ n as A,
26
+ s as D,
27
+ e as L,
28
+ t as c
29
+ };
@@ -0,0 +1,19 @@
1
+ import { createContext as a } from "react";
2
+ const r = a();
3
+ class o {
4
+ constructor() {
5
+ this.usedNamespaces = {};
6
+ }
7
+ addUsedNamespaces(s) {
8
+ s.forEach((e) => {
9
+ this.usedNamespaces[e] || (this.usedNamespaces[e] = !0);
10
+ });
11
+ }
12
+ getUsedNamespaces() {
13
+ return Object.keys(this.usedNamespaces);
14
+ }
15
+ }
16
+ export {
17
+ r as I,
18
+ o as R
19
+ };