@cagatayfdn/flora-components 0.0.71 → 0.0.73
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/Accordion.css +1 -0
- package/dist/ActionButton.css +1 -0
- package/dist/AlertCard.css +1 -0
- package/dist/Autocomplete.css +1 -0
- package/dist/Button.css +1 -0
- package/dist/Card.css +1 -0
- package/dist/Checkbox.css +1 -0
- package/dist/Config.css +1 -0
- package/dist/Confirm.css +1 -0
- package/dist/ContentHeader.css +1 -0
- package/dist/Datepicker.css +1 -0
- package/dist/Divider.css +1 -0
- package/dist/DropdownList.css +1 -0
- package/dist/ErrorLogModal.css +1 -0
- package/dist/FileUpload.css +1 -0
- package/dist/FileUpload.module-bCNvwTRa.js +32 -0
- package/dist/Heading.css +1 -0
- package/dist/InfoBoxList.css +1 -0
- package/dist/InfoBoxList.module-C6t2KDOB.js +8 -0
- package/dist/InfoDate.css +1 -0
- package/dist/InfoText.css +1 -0
- package/dist/Input.css +1 -0
- package/dist/Label.css +1 -0
- package/dist/Legends.css +1 -0
- package/dist/Loading.css +1 -0
- package/dist/MenuItem-BGZHvTKI.js +53 -0
- package/dist/MenuItem.css +1 -0
- package/dist/Modal.css +1 -0
- package/dist/NoResult.css +1 -0
- package/dist/PageWrap.css +1 -0
- package/dist/Pager.css +1 -0
- package/dist/Panel.css +1 -0
- package/dist/Radio.css +1 -0
- package/dist/ResultError.css +1 -0
- package/dist/ScrollContainer.css +1 -0
- package/dist/Select-DcLZCXNo.js +1831 -0
- package/dist/Select.css +1 -0
- package/dist/Select.module-BVWgPUEN.js +20 -0
- package/dist/StatusTypography.css +1 -0
- package/dist/Stepper.css +1 -0
- package/dist/Switch.css +1 -0
- package/dist/Tab.css +1 -0
- package/dist/TableHeader-B91BXue0.js +159 -0
- package/dist/TableHeader.css +1 -0
- package/dist/Textarea.css +1 -0
- package/dist/Tooltip.css +1 -0
- package/dist/Trans-B4ILpbwK.js +343 -0
- package/dist/TypographyText.css +1 -0
- package/dist/ValidationError.css +1 -0
- package/dist/_commonjsHelpers-CT_km90n.js +30 -0
- package/dist/_isArray-CBUZFxFA.js +6 -0
- package/dist/_isString-BUpNGP_8.js +6 -0
- package/dist/_reduce-DsUCMz4O.js +148 -0
- package/dist/assets/icons/icons.js +62 -0
- package/dist/assets/images/500_error_2x.gif +0 -0
- package/dist/assets/images/oms.png +0 -0
- package/dist/components/Accordion/Accordion.js +57 -0
- package/dist/components/ActionButton/ActionButton.js +54 -0
- package/dist/components/AlertCard/AlertCard.js +29 -0
- package/dist/components/AuthUserCan/Permission.js +18 -0
- package/dist/components/AuthUserCan/index.js +23 -0
- package/dist/components/Autocomplete/Autocomplete.js +87 -0
- package/dist/components/Button/Button.js +87 -0
- package/dist/components/Card/Card.js +21 -0
- package/dist/components/Charts/Bar.js +18 -0
- package/dist/components/Charts/Legends.js +21 -0
- package/dist/components/Charts/Line.js +18 -0
- package/dist/components/Charts/Pie.js +43 -0
- package/dist/components/Charts/index.js +31 -0
- package/dist/components/Charts/types.js +1 -0
- package/dist/components/Charts/utils.js +12 -0
- package/dist/components/Checkbox/Checkbox.js +119 -0
- package/dist/components/Config/Config.js +32 -0
- package/dist/components/Confirm/Confirm.js +52 -0
- package/dist/components/ContentHeader/ContentHeader.js +75 -0
- package/dist/components/ContentLoader/ContentLoader.js +16 -0
- package/dist/components/Countdown/Countdown.js +20 -0
- package/dist/components/Datepicker/Datepicker.js +1478 -0
- package/dist/components/Divider/Divider.js +26 -0
- package/dist/components/Dropdown/DropdownList.js +90 -0
- package/dist/components/ErrorLogModal/ErrorLogModal.js +63 -0
- package/dist/components/FileUpload/FileUpload.js +237 -0
- package/dist/components/FileUpload/ImagePreview.js +19 -0
- package/dist/components/FileUpload/LengthCard.js +6 -0
- package/dist/components/FileUpload/PreviewModal.js +53 -0
- package/dist/components/Grid/Column.js +29 -0
- package/dist/components/Grid/Row.js +6 -0
- package/dist/components/Heading/Heading.js +22 -0
- package/dist/components/Icon/index.js +24 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -0
- package/dist/components/InfoBoxList/InfoBoxList.js +30 -0
- package/dist/components/InfoBoxList/helper.js +83 -0
- package/dist/components/InfoDate/InfoDate.js +19 -0
- package/dist/components/InfoText/InfoText.js +13 -0
- package/dist/components/Input/Input.js +140 -0
- package/dist/components/Label/Label.js +22 -0
- package/dist/components/Loading/Loading.js +62 -0
- package/dist/components/Modal/Modal.js +57 -0
- package/dist/components/NavigatorCard/index.js +59 -0
- package/dist/components/NoResult/NoResult.js +12 -0
- package/dist/components/Notification/Notification.js +26 -0
- package/dist/components/PageWrapper/PageWrap.js +46 -0
- package/dist/components/Pager/Pager.js +103 -0
- package/dist/components/Panel/Panel.js +69 -0
- package/dist/components/PermaLink/PermaLink.js +34 -0
- package/dist/components/Radio/Radio.js +96 -0
- package/dist/components/ResultError/ResultError.js +20 -0
- package/dist/components/ScrollContainer/ScrollContainer.js +21 -0
- package/dist/components/Select/NoData.js +10 -0
- package/dist/components/Select/OptionItem.js +19 -0
- package/dist/components/Select/Select.js +13 -0
- package/dist/components/Sidebar/MenuItem.js +9 -0
- package/dist/components/Sidebar/index.js +137 -0
- package/dist/components/StatusTypography/StatusTypography.js +51 -0
- package/dist/components/Stepper/Stepper.js +72 -0
- package/dist/components/Switch/Switch.js +79 -0
- package/dist/components/Tab/Tab.js +28 -0
- package/dist/components/Table/Table.js +201 -0
- package/dist/components/Table/TableHeader.js +14 -0
- package/dist/components/Textarea/Textarea.js +95 -0
- package/dist/components/Tooltip/Tooltip.js +1548 -0
- package/dist/components/TypographyText/TypographyText.js +87 -0
- package/dist/components/ValidationError/ValidationError.js +7 -0
- package/dist/components/index.js +125 -0
- package/dist/defineProperty-DeKy1XT0.js +37 -0
- package/dist/enums/appearance.js +14 -0
- package/dist/enums/applicationTypeSlug.js +4 -0
- package/dist/enums/index.js +27 -0
- package/dist/enums/isActiveColor.js +4 -0
- package/dist/enums/size.js +4 -0
- package/dist/enums/status.js +9 -0
- package/dist/equals-PL9KqVQf.js +119 -0
- package/dist/flatpickr-CRz1AV0e.js +59 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useAauth.js +40 -0
- package/dist/hooks/useDisclosure.js +14 -0
- package/dist/hooks/useNiceModal.js +13 -0
- package/dist/i18nInstance-CiCZbaCK.js +55 -0
- package/dist/includes-8YTFrx85.js +46 -0
- package/dist/index-BHf7G3IG.js +35 -0
- package/dist/index-BJU1K2Aw.js +8003 -0
- package/dist/index-C9yacAGx.js +359 -0
- package/dist/index-CB61CB0b.js +669 -0
- package/dist/index-H7XbDVmH.js +320 -0
- package/dist/index-a0GSBrWt.js +364 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +181 -0
- package/dist/jsx-runtime-BcAkpsdy.js +631 -0
- package/dist/keys-B0bo5Q7o.js +67 -0
- package/dist/locales/en/index.js +613 -0
- package/dist/locales/i18n.js +1417 -0
- package/dist/locales/index.js +5 -0
- package/dist/locales/tr/index.js +613 -0
- package/dist/prodivers.css +6 -0
- package/dist/prodivers.js +12 -0
- package/dist/react-content-loader.es-CswLCxkm.js +90 -0
- package/dist/react-toastify.esm-BUWNP7Nm.js +808 -0
- package/dist/types/common/date.js +1 -0
- package/dist/types/common/events.js +1 -0
- package/dist/types/common/forms.js +1 -0
- package/dist/types/common/option.js +1 -0
- package/dist/types/index.js +1 -0
- package/dist/useTranslation-CnCPcxVj.js +142 -0
- package/dist/utils/date.js +413 -0
- package/dist/utils/flatpickr.js +4 -0
- package/dist/utils/helper.js +1463 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/language.js +46 -0
- package/dist/utils/validation.js +27 -0
- package/dist/utils/yup.js +2921 -0
- package/package.json +8 -2
- package/dist/index.cjs.js +0 -295
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -25008
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js +0 -295
- package/dist/index.umd.js.map +0 -1
- package/dist/style.css +0 -1
|
@@ -0,0 +1,1417 @@
|
|
|
1
|
+
import { buildYupLocale as ve } from "../utils/yup.js";
|
|
2
|
+
import me from "./en/index.js";
|
|
3
|
+
import ye from "./tr/index.js";
|
|
4
|
+
import { _ as be, t as xe, a as F } from "../defineProperty-DeKy1XT0.js";
|
|
5
|
+
import { s as Le, b as we } from "../i18nInstance-CiCZbaCK.js";
|
|
6
|
+
const Se = {
|
|
7
|
+
type: "3rdParty",
|
|
8
|
+
init(i) {
|
|
9
|
+
Le(i.options.react), we(i);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function x(i) {
|
|
13
|
+
for (var n = 1; n < arguments.length; n++) {
|
|
14
|
+
var r = arguments[n] != null ? Object(arguments[n]) : {}, e = Object.keys(r);
|
|
15
|
+
typeof Object.getOwnPropertySymbols == "function" && e.push.apply(e, Object.getOwnPropertySymbols(r).filter(function(t) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(r, t).enumerable;
|
|
17
|
+
})), e.forEach(function(t) {
|
|
18
|
+
be(i, t, r[t]);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return i;
|
|
22
|
+
}
|
|
23
|
+
function S(i, n) {
|
|
24
|
+
if (!(i instanceof n))
|
|
25
|
+
throw new TypeError("Cannot call a class as a function");
|
|
26
|
+
}
|
|
27
|
+
function ae(i, n) {
|
|
28
|
+
for (var r = 0; r < n.length; r++) {
|
|
29
|
+
var e = n[r];
|
|
30
|
+
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(i, xe(e.key), e);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function O(i, n, r) {
|
|
34
|
+
return n && ae(i.prototype, n), r && ae(i, r), Object.defineProperty(i, "prototype", {
|
|
35
|
+
writable: !1
|
|
36
|
+
}), i;
|
|
37
|
+
}
|
|
38
|
+
function N(i) {
|
|
39
|
+
if (i === void 0)
|
|
40
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
41
|
+
return i;
|
|
42
|
+
}
|
|
43
|
+
function D(i, n) {
|
|
44
|
+
if (n && (F(n) === "object" || typeof n == "function"))
|
|
45
|
+
return n;
|
|
46
|
+
if (n !== void 0)
|
|
47
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
48
|
+
return N(i);
|
|
49
|
+
}
|
|
50
|
+
function T(i) {
|
|
51
|
+
return T = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(r) {
|
|
52
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
53
|
+
}, T(i);
|
|
54
|
+
}
|
|
55
|
+
function q(i, n) {
|
|
56
|
+
return q = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
|
|
57
|
+
return e.__proto__ = t, e;
|
|
58
|
+
}, q(i, n);
|
|
59
|
+
}
|
|
60
|
+
function z(i, n) {
|
|
61
|
+
if (typeof n != "function" && n !== null)
|
|
62
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
63
|
+
i.prototype = Object.create(n && n.prototype, {
|
|
64
|
+
constructor: {
|
|
65
|
+
value: i,
|
|
66
|
+
writable: !0,
|
|
67
|
+
configurable: !0
|
|
68
|
+
}
|
|
69
|
+
}), Object.defineProperty(i, "prototype", {
|
|
70
|
+
writable: !1
|
|
71
|
+
}), n && q(i, n);
|
|
72
|
+
}
|
|
73
|
+
var Oe = {
|
|
74
|
+
type: "logger",
|
|
75
|
+
log: function(n) {
|
|
76
|
+
this.output("log", n);
|
|
77
|
+
},
|
|
78
|
+
warn: function(n) {
|
|
79
|
+
this.output("warn", n);
|
|
80
|
+
},
|
|
81
|
+
error: function(n) {
|
|
82
|
+
this.output("error", n);
|
|
83
|
+
},
|
|
84
|
+
output: function(n, r) {
|
|
85
|
+
console && console[n] && console[n].apply(console, r);
|
|
86
|
+
}
|
|
87
|
+
}, ke = function() {
|
|
88
|
+
function i(n) {
|
|
89
|
+
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
90
|
+
S(this, i), this.init(n, r);
|
|
91
|
+
}
|
|
92
|
+
return O(i, [{
|
|
93
|
+
key: "init",
|
|
94
|
+
value: function(r) {
|
|
95
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
96
|
+
this.prefix = e.prefix || "i18next:", this.logger = r || Oe, this.options = e, this.debug = e.debug;
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "setDebug",
|
|
100
|
+
value: function(r) {
|
|
101
|
+
this.debug = r;
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "log",
|
|
105
|
+
value: function() {
|
|
106
|
+
for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++)
|
|
107
|
+
e[t] = arguments[t];
|
|
108
|
+
return this.forward(e, "log", "", !0);
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "warn",
|
|
112
|
+
value: function() {
|
|
113
|
+
for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++)
|
|
114
|
+
e[t] = arguments[t];
|
|
115
|
+
return this.forward(e, "warn", "", !0);
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "error",
|
|
119
|
+
value: function() {
|
|
120
|
+
for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++)
|
|
121
|
+
e[t] = arguments[t];
|
|
122
|
+
return this.forward(e, "error", "");
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "deprecate",
|
|
126
|
+
value: function() {
|
|
127
|
+
for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++)
|
|
128
|
+
e[t] = arguments[t];
|
|
129
|
+
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "forward",
|
|
133
|
+
value: function(r, e, t, a) {
|
|
134
|
+
return a && !this.debug ? null : (typeof r[0] == "string" && (r[0] = "".concat(t).concat(this.prefix, " ").concat(r[0])), this.logger[e](r));
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "create",
|
|
138
|
+
value: function(r) {
|
|
139
|
+
return new i(this.logger, x({}, {
|
|
140
|
+
prefix: "".concat(this.prefix, ":").concat(r, ":")
|
|
141
|
+
}, this.options));
|
|
142
|
+
}
|
|
143
|
+
}]), i;
|
|
144
|
+
}(), w = new ke(), R = function() {
|
|
145
|
+
function i() {
|
|
146
|
+
S(this, i), this.observers = {};
|
|
147
|
+
}
|
|
148
|
+
return O(i, [{
|
|
149
|
+
key: "on",
|
|
150
|
+
value: function(r, e) {
|
|
151
|
+
var t = this;
|
|
152
|
+
return r.split(" ").forEach(function(a) {
|
|
153
|
+
t.observers[a] = t.observers[a] || [], t.observers[a].push(e);
|
|
154
|
+
}), this;
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "off",
|
|
158
|
+
value: function(r, e) {
|
|
159
|
+
if (this.observers[r]) {
|
|
160
|
+
if (!e) {
|
|
161
|
+
delete this.observers[r];
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.observers[r] = this.observers[r].filter(function(t) {
|
|
165
|
+
return t !== e;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "emit",
|
|
171
|
+
value: function(r) {
|
|
172
|
+
for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), a = 1; a < e; a++)
|
|
173
|
+
t[a - 1] = arguments[a];
|
|
174
|
+
if (this.observers[r]) {
|
|
175
|
+
var o = [].concat(this.observers[r]);
|
|
176
|
+
o.forEach(function(u) {
|
|
177
|
+
u.apply(void 0, t);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (this.observers["*"]) {
|
|
181
|
+
var s = [].concat(this.observers["*"]);
|
|
182
|
+
s.forEach(function(u) {
|
|
183
|
+
u.apply(u, [r].concat(t));
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}]), i;
|
|
188
|
+
}();
|
|
189
|
+
function U() {
|
|
190
|
+
var i, n, r = new Promise(function(e, t) {
|
|
191
|
+
i = e, n = t;
|
|
192
|
+
});
|
|
193
|
+
return r.resolve = i, r.reject = n, r;
|
|
194
|
+
}
|
|
195
|
+
function ie(i) {
|
|
196
|
+
return i == null ? "" : "" + i;
|
|
197
|
+
}
|
|
198
|
+
function Re(i, n, r) {
|
|
199
|
+
i.forEach(function(e) {
|
|
200
|
+
n[e] && (r[e] = n[e]);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function X(i, n, r) {
|
|
204
|
+
function e(s) {
|
|
205
|
+
return s && s.indexOf("###") > -1 ? s.replace(/###/g, ".") : s;
|
|
206
|
+
}
|
|
207
|
+
function t() {
|
|
208
|
+
return !i || typeof i == "string";
|
|
209
|
+
}
|
|
210
|
+
for (var a = typeof n != "string" ? [].concat(n) : n.split("."); a.length > 1; ) {
|
|
211
|
+
if (t())
|
|
212
|
+
return {};
|
|
213
|
+
var o = e(a.shift());
|
|
214
|
+
!i[o] && r && (i[o] = new r()), i = i[o];
|
|
215
|
+
}
|
|
216
|
+
return t() ? {} : {
|
|
217
|
+
obj: i,
|
|
218
|
+
k: e(a.shift())
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function se(i, n, r) {
|
|
222
|
+
var e = X(i, n, Object), t = e.obj, a = e.k;
|
|
223
|
+
t[a] = r;
|
|
224
|
+
}
|
|
225
|
+
function Pe(i, n, r, e) {
|
|
226
|
+
var t = X(i, n, Object), a = t.obj, o = t.k;
|
|
227
|
+
a[o] = a[o] || [], e && (a[o] = a[o].concat(r)), e || a[o].push(r);
|
|
228
|
+
}
|
|
229
|
+
function W(i, n) {
|
|
230
|
+
var r = X(i, n), e = r.obj, t = r.k;
|
|
231
|
+
if (e)
|
|
232
|
+
return e[t];
|
|
233
|
+
}
|
|
234
|
+
function oe(i, n, r) {
|
|
235
|
+
var e = W(i, r);
|
|
236
|
+
return e !== void 0 ? e : W(n, r);
|
|
237
|
+
}
|
|
238
|
+
function ce(i, n, r) {
|
|
239
|
+
for (var e in n)
|
|
240
|
+
e !== "__proto__" && e !== "constructor" && (e in i ? typeof i[e] == "string" || i[e] instanceof String || typeof n[e] == "string" || n[e] instanceof String ? r && (i[e] = n[e]) : ce(i[e], n[e], r) : i[e] = n[e]);
|
|
241
|
+
return i;
|
|
242
|
+
}
|
|
243
|
+
function j(i) {
|
|
244
|
+
return i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
245
|
+
}
|
|
246
|
+
var Ne = {
|
|
247
|
+
"&": "&",
|
|
248
|
+
"<": "<",
|
|
249
|
+
">": ">",
|
|
250
|
+
'"': """,
|
|
251
|
+
"'": "'",
|
|
252
|
+
"/": "/"
|
|
253
|
+
};
|
|
254
|
+
function Ce(i) {
|
|
255
|
+
return typeof i == "string" ? i.replace(/[&<>"'\/]/g, function(n) {
|
|
256
|
+
return Ne[n];
|
|
257
|
+
}) : i;
|
|
258
|
+
}
|
|
259
|
+
var J = typeof window < "u" && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf("MSIE") > -1, Ee = function(i) {
|
|
260
|
+
z(n, i);
|
|
261
|
+
function n(r) {
|
|
262
|
+
var e, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
263
|
+
ns: ["translation"],
|
|
264
|
+
defaultNS: "translation"
|
|
265
|
+
};
|
|
266
|
+
return S(this, n), e = D(this, T(n).call(this)), J && R.call(N(e)), e.data = r || {}, e.options = t, e.options.keySeparator === void 0 && (e.options.keySeparator = "."), e;
|
|
267
|
+
}
|
|
268
|
+
return O(n, [{
|
|
269
|
+
key: "addNamespaces",
|
|
270
|
+
value: function(e) {
|
|
271
|
+
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
272
|
+
}
|
|
273
|
+
}, {
|
|
274
|
+
key: "removeNamespaces",
|
|
275
|
+
value: function(e) {
|
|
276
|
+
var t = this.options.ns.indexOf(e);
|
|
277
|
+
t > -1 && this.options.ns.splice(t, 1);
|
|
278
|
+
}
|
|
279
|
+
}, {
|
|
280
|
+
key: "getResource",
|
|
281
|
+
value: function(e, t, a) {
|
|
282
|
+
var o = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, s = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator, u = [e, t];
|
|
283
|
+
return a && typeof a != "string" && (u = u.concat(a)), a && typeof a == "string" && (u = u.concat(s ? a.split(s) : a)), e.indexOf(".") > -1 && (u = e.split(".")), W(this.data, u);
|
|
284
|
+
}
|
|
285
|
+
}, {
|
|
286
|
+
key: "addResource",
|
|
287
|
+
value: function(e, t, a, o) {
|
|
288
|
+
var s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
289
|
+
silent: !1
|
|
290
|
+
}, u = this.options.keySeparator;
|
|
291
|
+
u === void 0 && (u = ".");
|
|
292
|
+
var l = [e, t];
|
|
293
|
+
a && (l = l.concat(u ? a.split(u) : a)), e.indexOf(".") > -1 && (l = e.split("."), o = t, t = l[1]), this.addNamespaces(t), se(this.data, l, o), s.silent || this.emit("added", e, t, a, o);
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
key: "addResources",
|
|
297
|
+
value: function(e, t, a) {
|
|
298
|
+
var o = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
|
|
299
|
+
silent: !1
|
|
300
|
+
};
|
|
301
|
+
for (var s in a)
|
|
302
|
+
(typeof a[s] == "string" || Object.prototype.toString.apply(a[s]) === "[object Array]") && this.addResource(e, t, s, a[s], {
|
|
303
|
+
silent: !0
|
|
304
|
+
});
|
|
305
|
+
o.silent || this.emit("added", e, t, a);
|
|
306
|
+
}
|
|
307
|
+
}, {
|
|
308
|
+
key: "addResourceBundle",
|
|
309
|
+
value: function(e, t, a, o, s) {
|
|
310
|
+
var u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
|
|
311
|
+
silent: !1
|
|
312
|
+
}, l = [e, t];
|
|
313
|
+
e.indexOf(".") > -1 && (l = e.split("."), o = a, a = t, t = l[1]), this.addNamespaces(t);
|
|
314
|
+
var f = W(this.data, l) || {};
|
|
315
|
+
o ? ce(f, a, s) : f = x({}, f, a), se(this.data, l, f), u.silent || this.emit("added", e, t, a);
|
|
316
|
+
}
|
|
317
|
+
}, {
|
|
318
|
+
key: "removeResourceBundle",
|
|
319
|
+
value: function(e, t) {
|
|
320
|
+
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
321
|
+
}
|
|
322
|
+
}, {
|
|
323
|
+
key: "hasResourceBundle",
|
|
324
|
+
value: function(e, t) {
|
|
325
|
+
return this.getResource(e, t) !== void 0;
|
|
326
|
+
}
|
|
327
|
+
}, {
|
|
328
|
+
key: "getResourceBundle",
|
|
329
|
+
value: function(e, t) {
|
|
330
|
+
return t || (t = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? x({}, {}, this.getResource(e, t)) : this.getResource(e, t);
|
|
331
|
+
}
|
|
332
|
+
}, {
|
|
333
|
+
key: "getDataByLanguage",
|
|
334
|
+
value: function(e) {
|
|
335
|
+
return this.data[e];
|
|
336
|
+
}
|
|
337
|
+
}, {
|
|
338
|
+
key: "toJSON",
|
|
339
|
+
value: function() {
|
|
340
|
+
return this.data;
|
|
341
|
+
}
|
|
342
|
+
}]), n;
|
|
343
|
+
}(R), ge = {
|
|
344
|
+
processors: {},
|
|
345
|
+
addPostProcessor: function(n) {
|
|
346
|
+
this.processors[n.name] = n;
|
|
347
|
+
},
|
|
348
|
+
handle: function(n, r, e, t, a) {
|
|
349
|
+
var o = this;
|
|
350
|
+
return n.forEach(function(s) {
|
|
351
|
+
o.processors[s] && (r = o.processors[s].process(r, e, t, a));
|
|
352
|
+
}), r;
|
|
353
|
+
}
|
|
354
|
+
}, ue = {}, le = function(i) {
|
|
355
|
+
z(n, i);
|
|
356
|
+
function n(r) {
|
|
357
|
+
var e, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
358
|
+
return S(this, n), e = D(this, T(n).call(this)), J && R.call(N(e)), Re(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], r, N(e)), e.options = t, e.options.keySeparator === void 0 && (e.options.keySeparator = "."), e.logger = w.create("translator"), e;
|
|
359
|
+
}
|
|
360
|
+
return O(n, [{
|
|
361
|
+
key: "changeLanguage",
|
|
362
|
+
value: function(e) {
|
|
363
|
+
e && (this.language = e);
|
|
364
|
+
}
|
|
365
|
+
}, {
|
|
366
|
+
key: "exists",
|
|
367
|
+
value: function(e) {
|
|
368
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
369
|
+
interpolation: {}
|
|
370
|
+
}, a = this.resolve(e, t);
|
|
371
|
+
return a && a.res !== void 0;
|
|
372
|
+
}
|
|
373
|
+
}, {
|
|
374
|
+
key: "extractFromKey",
|
|
375
|
+
value: function(e, t) {
|
|
376
|
+
var a = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
|
|
377
|
+
a === void 0 && (a = ":");
|
|
378
|
+
var o = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, s = t.ns || this.options.defaultNS;
|
|
379
|
+
if (a && e.indexOf(a) > -1) {
|
|
380
|
+
var u = e.match(this.interpolator.nestingRegexp);
|
|
381
|
+
if (u && u.length > 0)
|
|
382
|
+
return {
|
|
383
|
+
key: e,
|
|
384
|
+
namespaces: s
|
|
385
|
+
};
|
|
386
|
+
var l = e.split(a);
|
|
387
|
+
(a !== o || a === o && this.options.ns.indexOf(l[0]) > -1) && (s = l.shift()), e = l.join(o);
|
|
388
|
+
}
|
|
389
|
+
return typeof s == "string" && (s = [s]), {
|
|
390
|
+
key: e,
|
|
391
|
+
namespaces: s
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
}, {
|
|
395
|
+
key: "translate",
|
|
396
|
+
value: function(e, t, a) {
|
|
397
|
+
var o = this;
|
|
398
|
+
if (F(t) !== "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), t || (t = {}), e == null)
|
|
399
|
+
return "";
|
|
400
|
+
Array.isArray(e) || (e = [String(e)]);
|
|
401
|
+
var s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, u = this.extractFromKey(e[e.length - 1], t), l = u.key, f = u.namespaces, c = f[f.length - 1], d = t.lng || this.language, h = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
402
|
+
if (d && d.toLowerCase() === "cimode") {
|
|
403
|
+
if (h) {
|
|
404
|
+
var p = t.nsSeparator || this.options.nsSeparator;
|
|
405
|
+
return c + p + l;
|
|
406
|
+
}
|
|
407
|
+
return l;
|
|
408
|
+
}
|
|
409
|
+
var v = this.resolve(e, t), g = v && v.res, m = v && v.usedKey || l, y = v && v.exactUsedKey || l, b = Object.prototype.toString.apply(g), k = ["[object Number]", "[object Function]", "[object RegExp]"], L = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, C = !this.i18nFormat || this.i18nFormat.handleAsObject, _ = typeof g != "string" && typeof g != "boolean" && typeof g != "number";
|
|
410
|
+
if (C && g && _ && k.indexOf(b) < 0 && !(typeof L == "string" && b === "[object Array]")) {
|
|
411
|
+
if (!t.returnObjects && !this.options.returnObjects)
|
|
412
|
+
return this.logger.warn("accessing an object - but returnObjects options is not enabled!"), this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, g, t) : "key '".concat(l, " (").concat(this.language, ")' returned an object instead of string.");
|
|
413
|
+
if (s) {
|
|
414
|
+
var Z = b === "[object Array]", H = Z ? [] : {}, he = Z ? y : m;
|
|
415
|
+
for (var E in g)
|
|
416
|
+
if (Object.prototype.hasOwnProperty.call(g, E)) {
|
|
417
|
+
var ee = "".concat(he).concat(s).concat(E);
|
|
418
|
+
H[E] = this.translate(ee, x({}, t, {
|
|
419
|
+
joinArrays: !1,
|
|
420
|
+
ns: f
|
|
421
|
+
})), H[E] === ee && (H[E] = g[E]);
|
|
422
|
+
}
|
|
423
|
+
g = H;
|
|
424
|
+
}
|
|
425
|
+
} else if (C && typeof L == "string" && b === "[object Array]")
|
|
426
|
+
g = g.join(L), g && (g = this.extendTranslation(g, e, t, a));
|
|
427
|
+
else {
|
|
428
|
+
var te = !1, K = !1;
|
|
429
|
+
if (!this.isValidLookup(g) && t.defaultValue !== void 0) {
|
|
430
|
+
if (te = !0, t.count !== void 0) {
|
|
431
|
+
var de = this.pluralResolver.getSuffix(d, t.count);
|
|
432
|
+
g = t["defaultValue".concat(de)];
|
|
433
|
+
}
|
|
434
|
+
g || (g = t.defaultValue);
|
|
435
|
+
}
|
|
436
|
+
this.isValidLookup(g) || (K = !0, g = l);
|
|
437
|
+
var P = t.defaultValue && t.defaultValue !== g && this.options.updateMissing;
|
|
438
|
+
if (K || te || P) {
|
|
439
|
+
if (this.logger.log(P ? "updateKey" : "missingKey", d, c, l, P ? t.defaultValue : g), s) {
|
|
440
|
+
var ne = this.resolve(l, x({}, t, {
|
|
441
|
+
keySeparator: !1
|
|
442
|
+
}));
|
|
443
|
+
ne && ne.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
444
|
+
}
|
|
445
|
+
var V = [], B = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
|
|
446
|
+
if (this.options.saveMissingTo === "fallback" && B && B[0])
|
|
447
|
+
for (var $ = 0; $ < B.length; $++)
|
|
448
|
+
V.push(B[$]);
|
|
449
|
+
else
|
|
450
|
+
this.options.saveMissingTo === "all" ? V = this.languageUtils.toResolveHierarchy(t.lng || this.language) : V.push(t.lng || this.language);
|
|
451
|
+
var re = function(I, A) {
|
|
452
|
+
o.options.missingKeyHandler ? o.options.missingKeyHandler(I, c, A, P ? t.defaultValue : g, P, t) : o.backendConnector && o.backendConnector.saveMissing && o.backendConnector.saveMissing(I, c, A, P ? t.defaultValue : g, P, t), o.emit("missingKey", I, c, A, g);
|
|
453
|
+
};
|
|
454
|
+
if (this.options.saveMissing) {
|
|
455
|
+
var pe = t.count !== void 0 && typeof t.count != "string";
|
|
456
|
+
this.options.saveMissingPlurals && pe ? V.forEach(function(Y) {
|
|
457
|
+
var I = o.pluralResolver.getPluralFormsOfKey(Y, l);
|
|
458
|
+
I.forEach(function(A) {
|
|
459
|
+
return re([Y], A);
|
|
460
|
+
});
|
|
461
|
+
}) : re(V, l);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
g = this.extendTranslation(g, e, t, v, a), K && g === l && this.options.appendNamespaceToMissingKey && (g = "".concat(c, ":").concat(l)), K && this.options.parseMissingKeyHandler && (g = this.options.parseMissingKeyHandler(g));
|
|
465
|
+
}
|
|
466
|
+
return g;
|
|
467
|
+
}
|
|
468
|
+
}, {
|
|
469
|
+
key: "extendTranslation",
|
|
470
|
+
value: function(e, t, a, o, s) {
|
|
471
|
+
var u = this;
|
|
472
|
+
if (this.i18nFormat && this.i18nFormat.parse)
|
|
473
|
+
e = this.i18nFormat.parse(e, a, o.usedLng, o.usedNS, o.usedKey, {
|
|
474
|
+
resolved: o
|
|
475
|
+
});
|
|
476
|
+
else if (!a.skipInterpolation) {
|
|
477
|
+
a.interpolation && this.interpolator.init(x({}, a, {
|
|
478
|
+
interpolation: x({}, this.options.interpolation, a.interpolation)
|
|
479
|
+
}));
|
|
480
|
+
var l = a.interpolation && a.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables, f;
|
|
481
|
+
if (l) {
|
|
482
|
+
var c = e.match(this.interpolator.nestingRegexp);
|
|
483
|
+
f = c && c.length;
|
|
484
|
+
}
|
|
485
|
+
var d = a.replace && typeof a.replace != "string" ? a.replace : a;
|
|
486
|
+
if (this.options.interpolation.defaultVariables && (d = x({}, this.options.interpolation.defaultVariables, d)), e = this.interpolator.interpolate(e, d, a.lng || this.language, a), l) {
|
|
487
|
+
var h = e.match(this.interpolator.nestingRegexp), p = h && h.length;
|
|
488
|
+
f < p && (a.nest = !1);
|
|
489
|
+
}
|
|
490
|
+
a.nest !== !1 && (e = this.interpolator.nest(e, function() {
|
|
491
|
+
for (var m = arguments.length, y = new Array(m), b = 0; b < m; b++)
|
|
492
|
+
y[b] = arguments[b];
|
|
493
|
+
return s && s[0] === y[0] && !a.context ? (u.logger.warn("It seems you are nesting recursively key: ".concat(y[0], " in key: ").concat(t[0])), null) : u.translate.apply(u, y.concat([t]));
|
|
494
|
+
}, a)), a.interpolation && this.interpolator.reset();
|
|
495
|
+
}
|
|
496
|
+
var v = a.postProcess || this.options.postProcess, g = typeof v == "string" ? [v] : v;
|
|
497
|
+
return e != null && g && g.length && a.applyPostProcessor !== !1 && (e = ge.handle(g, e, t, this.options && this.options.postProcessPassResolved ? x({
|
|
498
|
+
i18nResolved: o
|
|
499
|
+
}, a) : a, this)), e;
|
|
500
|
+
}
|
|
501
|
+
}, {
|
|
502
|
+
key: "resolve",
|
|
503
|
+
value: function(e) {
|
|
504
|
+
var t = this, a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o, s, u, l, f;
|
|
505
|
+
return typeof e == "string" && (e = [e]), e.forEach(function(c) {
|
|
506
|
+
if (!t.isValidLookup(o)) {
|
|
507
|
+
var d = t.extractFromKey(c, a), h = d.key;
|
|
508
|
+
s = h;
|
|
509
|
+
var p = d.namespaces;
|
|
510
|
+
t.options.fallbackNS && (p = p.concat(t.options.fallbackNS));
|
|
511
|
+
var v = a.count !== void 0 && typeof a.count != "string", g = a.context !== void 0 && typeof a.context == "string" && a.context !== "", m = a.lngs ? a.lngs : t.languageUtils.toResolveHierarchy(a.lng || t.language, a.fallbackLng);
|
|
512
|
+
p.forEach(function(y) {
|
|
513
|
+
t.isValidLookup(o) || (f = y, !ue["".concat(m[0], "-").concat(y)] && t.utils && t.utils.hasLoadedNamespace && !t.utils.hasLoadedNamespace(f) && (ue["".concat(m[0], "-").concat(y)] = !0, t.logger.warn('key "'.concat(s, '" for languages "').concat(m.join(", "), `" won't get resolved as namespace "`).concat(f, '" 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!!!")), m.forEach(function(b) {
|
|
514
|
+
if (!t.isValidLookup(o)) {
|
|
515
|
+
l = b;
|
|
516
|
+
var k = h, L = [k];
|
|
517
|
+
if (t.i18nFormat && t.i18nFormat.addLookupKeys)
|
|
518
|
+
t.i18nFormat.addLookupKeys(L, h, b, y, a);
|
|
519
|
+
else {
|
|
520
|
+
var C;
|
|
521
|
+
v && (C = t.pluralResolver.getSuffix(b, a.count)), v && g && L.push(k + C), g && L.push(k += "".concat(t.options.contextSeparator).concat(a.context)), v && L.push(k += C);
|
|
522
|
+
}
|
|
523
|
+
for (var _; _ = L.pop(); )
|
|
524
|
+
t.isValidLookup(o) || (u = _, o = t.getResource(b, y, _, a));
|
|
525
|
+
}
|
|
526
|
+
}));
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}), {
|
|
530
|
+
res: o,
|
|
531
|
+
usedKey: s,
|
|
532
|
+
exactUsedKey: u,
|
|
533
|
+
usedLng: l,
|
|
534
|
+
usedNS: f
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
}, {
|
|
538
|
+
key: "isValidLookup",
|
|
539
|
+
value: function(e) {
|
|
540
|
+
return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
|
|
541
|
+
}
|
|
542
|
+
}, {
|
|
543
|
+
key: "getResource",
|
|
544
|
+
value: function(e, t, a) {
|
|
545
|
+
var o = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
546
|
+
return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, t, a, o) : this.resourceStore.getResource(e, t, a, o);
|
|
547
|
+
}
|
|
548
|
+
}]), n;
|
|
549
|
+
}(R);
|
|
550
|
+
function G(i) {
|
|
551
|
+
return i.charAt(0).toUpperCase() + i.slice(1);
|
|
552
|
+
}
|
|
553
|
+
var je = function() {
|
|
554
|
+
function i(n) {
|
|
555
|
+
S(this, i), this.options = n, this.whitelist = this.options.supportedLngs || !1, this.supportedLngs = this.options.supportedLngs || !1, this.logger = w.create("languageUtils");
|
|
556
|
+
}
|
|
557
|
+
return O(i, [{
|
|
558
|
+
key: "getScriptPartFromCode",
|
|
559
|
+
value: function(r) {
|
|
560
|
+
if (!r || r.indexOf("-") < 0)
|
|
561
|
+
return null;
|
|
562
|
+
var e = r.split("-");
|
|
563
|
+
return e.length === 2 || (e.pop(), e[e.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(e.join("-"));
|
|
564
|
+
}
|
|
565
|
+
}, {
|
|
566
|
+
key: "getLanguagePartFromCode",
|
|
567
|
+
value: function(r) {
|
|
568
|
+
if (!r || r.indexOf("-") < 0)
|
|
569
|
+
return r;
|
|
570
|
+
var e = r.split("-");
|
|
571
|
+
return this.formatLanguageCode(e[0]);
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "formatLanguageCode",
|
|
575
|
+
value: function(r) {
|
|
576
|
+
if (typeof r == "string" && r.indexOf("-") > -1) {
|
|
577
|
+
var e = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"], t = r.split("-");
|
|
578
|
+
return this.options.lowerCaseLng ? t = t.map(function(a) {
|
|
579
|
+
return a.toLowerCase();
|
|
580
|
+
}) : t.length === 2 ? (t[0] = t[0].toLowerCase(), t[1] = t[1].toUpperCase(), e.indexOf(t[1].toLowerCase()) > -1 && (t[1] = G(t[1].toLowerCase()))) : t.length === 3 && (t[0] = t[0].toLowerCase(), t[1].length === 2 && (t[1] = t[1].toUpperCase()), t[0] !== "sgn" && t[2].length === 2 && (t[2] = t[2].toUpperCase()), e.indexOf(t[1].toLowerCase()) > -1 && (t[1] = G(t[1].toLowerCase())), e.indexOf(t[2].toLowerCase()) > -1 && (t[2] = G(t[2].toLowerCase()))), t.join("-");
|
|
581
|
+
}
|
|
582
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? r.toLowerCase() : r;
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
key: "isWhitelisted",
|
|
586
|
+
value: function(r) {
|
|
587
|
+
return this.logger.deprecate("languageUtils.isWhitelisted", `function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it's usage asap.`), this.isSupportedCode(r);
|
|
588
|
+
}
|
|
589
|
+
}, {
|
|
590
|
+
key: "isSupportedCode",
|
|
591
|
+
value: function(r) {
|
|
592
|
+
return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (r = this.getLanguagePartFromCode(r)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(r) > -1;
|
|
593
|
+
}
|
|
594
|
+
}, {
|
|
595
|
+
key: "getBestMatchFromCodes",
|
|
596
|
+
value: function(r) {
|
|
597
|
+
var e = this;
|
|
598
|
+
if (!r)
|
|
599
|
+
return null;
|
|
600
|
+
var t;
|
|
601
|
+
return r.forEach(function(a) {
|
|
602
|
+
if (!t) {
|
|
603
|
+
var o = e.formatLanguageCode(a);
|
|
604
|
+
(!e.options.supportedLngs || e.isSupportedCode(o)) && (t = o);
|
|
605
|
+
}
|
|
606
|
+
}), !t && this.options.supportedLngs && r.forEach(function(a) {
|
|
607
|
+
if (!t) {
|
|
608
|
+
var o = e.getLanguagePartFromCode(a);
|
|
609
|
+
if (e.isSupportedCode(o))
|
|
610
|
+
return t = o;
|
|
611
|
+
t = e.options.supportedLngs.find(function(s) {
|
|
612
|
+
if (s.indexOf(o) === 0)
|
|
613
|
+
return s;
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
|
|
617
|
+
}
|
|
618
|
+
}, {
|
|
619
|
+
key: "getFallbackCodes",
|
|
620
|
+
value: function(r, e) {
|
|
621
|
+
if (!r)
|
|
622
|
+
return [];
|
|
623
|
+
if (typeof r == "function" && (r = r(e)), typeof r == "string" && (r = [r]), Object.prototype.toString.apply(r) === "[object Array]")
|
|
624
|
+
return r;
|
|
625
|
+
if (!e)
|
|
626
|
+
return r.default || [];
|
|
627
|
+
var t = r[e];
|
|
628
|
+
return t || (t = r[this.getScriptPartFromCode(e)]), t || (t = r[this.formatLanguageCode(e)]), t || (t = r[this.getLanguagePartFromCode(e)]), t || (t = r.default), t || [];
|
|
629
|
+
}
|
|
630
|
+
}, {
|
|
631
|
+
key: "toResolveHierarchy",
|
|
632
|
+
value: function(r, e) {
|
|
633
|
+
var t = this, a = this.getFallbackCodes(e || this.options.fallbackLng || [], r), o = [], s = function(l) {
|
|
634
|
+
l && (t.isSupportedCode(l) ? o.push(l) : t.logger.warn("rejecting language code not found in supportedLngs: ".concat(l)));
|
|
635
|
+
};
|
|
636
|
+
return typeof r == "string" && r.indexOf("-") > -1 ? (this.options.load !== "languageOnly" && s(this.formatLanguageCode(r)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && s(this.getScriptPartFromCode(r)), this.options.load !== "currentOnly" && s(this.getLanguagePartFromCode(r))) : typeof r == "string" && s(this.formatLanguageCode(r)), a.forEach(function(u) {
|
|
637
|
+
o.indexOf(u) < 0 && s(t.formatLanguageCode(u));
|
|
638
|
+
}), o;
|
|
639
|
+
}
|
|
640
|
+
}]), i;
|
|
641
|
+
}(), Fe = [{
|
|
642
|
+
lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "ti", "tr", "uz", "wa"],
|
|
643
|
+
nr: [1, 2],
|
|
644
|
+
fc: 1
|
|
645
|
+
}, {
|
|
646
|
+
lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
|
|
647
|
+
nr: [1, 2],
|
|
648
|
+
fc: 2
|
|
649
|
+
}, {
|
|
650
|
+
lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "kk", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
|
|
651
|
+
nr: [1],
|
|
652
|
+
fc: 3
|
|
653
|
+
}, {
|
|
654
|
+
lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
|
|
655
|
+
nr: [1, 2, 5],
|
|
656
|
+
fc: 4
|
|
657
|
+
}, {
|
|
658
|
+
lngs: ["ar"],
|
|
659
|
+
nr: [0, 1, 2, 3, 11, 100],
|
|
660
|
+
fc: 5
|
|
661
|
+
}, {
|
|
662
|
+
lngs: ["cs", "sk"],
|
|
663
|
+
nr: [1, 2, 5],
|
|
664
|
+
fc: 6
|
|
665
|
+
}, {
|
|
666
|
+
lngs: ["csb", "pl"],
|
|
667
|
+
nr: [1, 2, 5],
|
|
668
|
+
fc: 7
|
|
669
|
+
}, {
|
|
670
|
+
lngs: ["cy"],
|
|
671
|
+
nr: [1, 2, 3, 8],
|
|
672
|
+
fc: 8
|
|
673
|
+
}, {
|
|
674
|
+
lngs: ["fr"],
|
|
675
|
+
nr: [1, 2],
|
|
676
|
+
fc: 9
|
|
677
|
+
}, {
|
|
678
|
+
lngs: ["ga"],
|
|
679
|
+
nr: [1, 2, 3, 7, 11],
|
|
680
|
+
fc: 10
|
|
681
|
+
}, {
|
|
682
|
+
lngs: ["gd"],
|
|
683
|
+
nr: [1, 2, 3, 20],
|
|
684
|
+
fc: 11
|
|
685
|
+
}, {
|
|
686
|
+
lngs: ["is"],
|
|
687
|
+
nr: [1, 2],
|
|
688
|
+
fc: 12
|
|
689
|
+
}, {
|
|
690
|
+
lngs: ["jv"],
|
|
691
|
+
nr: [0, 1],
|
|
692
|
+
fc: 13
|
|
693
|
+
}, {
|
|
694
|
+
lngs: ["kw"],
|
|
695
|
+
nr: [1, 2, 3, 4],
|
|
696
|
+
fc: 14
|
|
697
|
+
}, {
|
|
698
|
+
lngs: ["lt"],
|
|
699
|
+
nr: [1, 2, 10],
|
|
700
|
+
fc: 15
|
|
701
|
+
}, {
|
|
702
|
+
lngs: ["lv"],
|
|
703
|
+
nr: [1, 2, 0],
|
|
704
|
+
fc: 16
|
|
705
|
+
}, {
|
|
706
|
+
lngs: ["mk"],
|
|
707
|
+
nr: [1, 2],
|
|
708
|
+
fc: 17
|
|
709
|
+
}, {
|
|
710
|
+
lngs: ["mnk"],
|
|
711
|
+
nr: [0, 1, 2],
|
|
712
|
+
fc: 18
|
|
713
|
+
}, {
|
|
714
|
+
lngs: ["mt"],
|
|
715
|
+
nr: [1, 2, 11, 20],
|
|
716
|
+
fc: 19
|
|
717
|
+
}, {
|
|
718
|
+
lngs: ["or"],
|
|
719
|
+
nr: [2, 1],
|
|
720
|
+
fc: 2
|
|
721
|
+
}, {
|
|
722
|
+
lngs: ["ro"],
|
|
723
|
+
nr: [1, 2, 20],
|
|
724
|
+
fc: 20
|
|
725
|
+
}, {
|
|
726
|
+
lngs: ["sl"],
|
|
727
|
+
nr: [5, 1, 2, 3],
|
|
728
|
+
fc: 21
|
|
729
|
+
}, {
|
|
730
|
+
lngs: ["he", "iw"],
|
|
731
|
+
nr: [1, 2, 20, 21],
|
|
732
|
+
fc: 22
|
|
733
|
+
}], Te = {
|
|
734
|
+
1: function(n) {
|
|
735
|
+
return +(n > 1);
|
|
736
|
+
},
|
|
737
|
+
2: function(n) {
|
|
738
|
+
return +(n != 1);
|
|
739
|
+
},
|
|
740
|
+
3: function(n) {
|
|
741
|
+
return 0;
|
|
742
|
+
},
|
|
743
|
+
4: function(n) {
|
|
744
|
+
return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
|
|
745
|
+
},
|
|
746
|
+
5: function(n) {
|
|
747
|
+
return n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
|
|
748
|
+
},
|
|
749
|
+
6: function(n) {
|
|
750
|
+
return n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2;
|
|
751
|
+
},
|
|
752
|
+
7: function(n) {
|
|
753
|
+
return n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
|
|
754
|
+
},
|
|
755
|
+
8: function(n) {
|
|
756
|
+
return n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3;
|
|
757
|
+
},
|
|
758
|
+
9: function(n) {
|
|
759
|
+
return +(n >= 2);
|
|
760
|
+
},
|
|
761
|
+
10: function(n) {
|
|
762
|
+
return n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4;
|
|
763
|
+
},
|
|
764
|
+
11: function(n) {
|
|
765
|
+
return n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3;
|
|
766
|
+
},
|
|
767
|
+
12: function(n) {
|
|
768
|
+
return +(n % 10 != 1 || n % 100 == 11);
|
|
769
|
+
},
|
|
770
|
+
13: function(n) {
|
|
771
|
+
return +(n !== 0);
|
|
772
|
+
},
|
|
773
|
+
14: function(n) {
|
|
774
|
+
return n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3;
|
|
775
|
+
},
|
|
776
|
+
15: function(n) {
|
|
777
|
+
return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
|
|
778
|
+
},
|
|
779
|
+
16: function(n) {
|
|
780
|
+
return n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2;
|
|
781
|
+
},
|
|
782
|
+
17: function(n) {
|
|
783
|
+
return n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1;
|
|
784
|
+
},
|
|
785
|
+
18: function(n) {
|
|
786
|
+
return n == 0 ? 0 : n == 1 ? 1 : 2;
|
|
787
|
+
},
|
|
788
|
+
19: function(n) {
|
|
789
|
+
return n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3;
|
|
790
|
+
},
|
|
791
|
+
20: function(n) {
|
|
792
|
+
return n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2;
|
|
793
|
+
},
|
|
794
|
+
21: function(n) {
|
|
795
|
+
return n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0;
|
|
796
|
+
},
|
|
797
|
+
22: function(n) {
|
|
798
|
+
return n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3;
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
function _e() {
|
|
802
|
+
var i = {};
|
|
803
|
+
return Fe.forEach(function(n) {
|
|
804
|
+
n.lngs.forEach(function(r) {
|
|
805
|
+
i[r] = {
|
|
806
|
+
numbers: n.nr,
|
|
807
|
+
plurals: Te[n.fc]
|
|
808
|
+
};
|
|
809
|
+
});
|
|
810
|
+
}), i;
|
|
811
|
+
}
|
|
812
|
+
var Ve = function() {
|
|
813
|
+
function i(n) {
|
|
814
|
+
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
815
|
+
S(this, i), this.languageUtils = n, this.options = r, this.logger = w.create("pluralResolver"), this.rules = _e();
|
|
816
|
+
}
|
|
817
|
+
return O(i, [{
|
|
818
|
+
key: "addRule",
|
|
819
|
+
value: function(r, e) {
|
|
820
|
+
this.rules[r] = e;
|
|
821
|
+
}
|
|
822
|
+
}, {
|
|
823
|
+
key: "getRule",
|
|
824
|
+
value: function(r) {
|
|
825
|
+
return this.rules[r] || this.rules[this.languageUtils.getLanguagePartFromCode(r)];
|
|
826
|
+
}
|
|
827
|
+
}, {
|
|
828
|
+
key: "needsPlural",
|
|
829
|
+
value: function(r) {
|
|
830
|
+
var e = this.getRule(r);
|
|
831
|
+
return e && e.numbers.length > 1;
|
|
832
|
+
}
|
|
833
|
+
}, {
|
|
834
|
+
key: "getPluralFormsOfKey",
|
|
835
|
+
value: function(r, e) {
|
|
836
|
+
var t = this, a = [], o = this.getRule(r);
|
|
837
|
+
return o && o.numbers.forEach(function(s) {
|
|
838
|
+
var u = t.getSuffix(r, s);
|
|
839
|
+
a.push("".concat(e).concat(u));
|
|
840
|
+
}), a;
|
|
841
|
+
}
|
|
842
|
+
}, {
|
|
843
|
+
key: "getSuffix",
|
|
844
|
+
value: function(r, e) {
|
|
845
|
+
var t = this, a = this.getRule(r);
|
|
846
|
+
if (a) {
|
|
847
|
+
var o = a.noAbs ? a.plurals(e) : a.plurals(Math.abs(e)), s = a.numbers[o];
|
|
848
|
+
this.options.simplifyPluralSuffix && a.numbers.length === 2 && a.numbers[0] === 1 && (s === 2 ? s = "plural" : s === 1 && (s = ""));
|
|
849
|
+
var u = function() {
|
|
850
|
+
return t.options.prepend && s.toString() ? t.options.prepend + s.toString() : s.toString();
|
|
851
|
+
};
|
|
852
|
+
return this.options.compatibilityJSON === "v1" ? s === 1 ? "" : typeof s == "number" ? "_plural_".concat(s.toString()) : u() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && a.numbers.length === 2 && a.numbers[0] === 1 ? u() : this.options.prepend && o.toString() ? this.options.prepend + o.toString() : o.toString();
|
|
853
|
+
}
|
|
854
|
+
return this.logger.warn("no plural rule found for: ".concat(r)), "";
|
|
855
|
+
}
|
|
856
|
+
}]), i;
|
|
857
|
+
}(), Ie = function() {
|
|
858
|
+
function i() {
|
|
859
|
+
var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
860
|
+
S(this, i), this.logger = w.create("interpolator"), this.options = n, this.format = n.interpolation && n.interpolation.format || function(r) {
|
|
861
|
+
return r;
|
|
862
|
+
}, this.init(n);
|
|
863
|
+
}
|
|
864
|
+
return O(i, [{
|
|
865
|
+
key: "init",
|
|
866
|
+
value: function() {
|
|
867
|
+
var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
868
|
+
r.interpolation || (r.interpolation = {
|
|
869
|
+
escapeValue: !0
|
|
870
|
+
});
|
|
871
|
+
var e = r.interpolation;
|
|
872
|
+
this.escape = e.escape !== void 0 ? e.escape : Ce, this.escapeValue = e.escapeValue !== void 0 ? e.escapeValue : !0, this.useRawValueToEscape = e.useRawValueToEscape !== void 0 ? e.useRawValueToEscape : !1, this.prefix = e.prefix ? j(e.prefix) : e.prefixEscaped || "{{", this.suffix = e.suffix ? j(e.suffix) : e.suffixEscaped || "}}", this.formatSeparator = e.formatSeparator ? e.formatSeparator : e.formatSeparator || ",", this.unescapePrefix = e.unescapeSuffix ? "" : e.unescapePrefix || "-", this.unescapeSuffix = this.unescapePrefix ? "" : e.unescapeSuffix || "", this.nestingPrefix = e.nestingPrefix ? j(e.nestingPrefix) : e.nestingPrefixEscaped || j("$t("), this.nestingSuffix = e.nestingSuffix ? j(e.nestingSuffix) : e.nestingSuffixEscaped || j(")"), this.nestingOptionsSeparator = e.nestingOptionsSeparator ? e.nestingOptionsSeparator : e.nestingOptionsSeparator || ",", this.maxReplaces = e.maxReplaces ? e.maxReplaces : 1e3, this.alwaysFormat = e.alwaysFormat !== void 0 ? e.alwaysFormat : !1, this.resetRegExp();
|
|
873
|
+
}
|
|
874
|
+
}, {
|
|
875
|
+
key: "reset",
|
|
876
|
+
value: function() {
|
|
877
|
+
this.options && this.init(this.options);
|
|
878
|
+
}
|
|
879
|
+
}, {
|
|
880
|
+
key: "resetRegExp",
|
|
881
|
+
value: function() {
|
|
882
|
+
var r = "".concat(this.prefix, "(.+?)").concat(this.suffix);
|
|
883
|
+
this.regexp = new RegExp(r, "g");
|
|
884
|
+
var e = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
|
|
885
|
+
this.regexpUnescape = new RegExp(e, "g");
|
|
886
|
+
var t = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
|
|
887
|
+
this.nestingRegexp = new RegExp(t, "g");
|
|
888
|
+
}
|
|
889
|
+
}, {
|
|
890
|
+
key: "interpolate",
|
|
891
|
+
value: function(r, e, t, a) {
|
|
892
|
+
var o = this, s, u, l, f = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
|
|
893
|
+
function c(g) {
|
|
894
|
+
return g.replace(/\$/g, "$$$$");
|
|
895
|
+
}
|
|
896
|
+
var d = function(m) {
|
|
897
|
+
if (m.indexOf(o.formatSeparator) < 0) {
|
|
898
|
+
var y = oe(e, f, m);
|
|
899
|
+
return o.alwaysFormat ? o.format(y, void 0, t) : y;
|
|
900
|
+
}
|
|
901
|
+
var b = m.split(o.formatSeparator), k = b.shift().trim(), L = b.join(o.formatSeparator).trim();
|
|
902
|
+
return o.format(oe(e, f, k), L, t, a);
|
|
903
|
+
};
|
|
904
|
+
this.resetRegExp();
|
|
905
|
+
var h = a && a.missingInterpolationHandler || this.options.missingInterpolationHandler, p = a && a.interpolation && a.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables, v = [{
|
|
906
|
+
regex: this.regexpUnescape,
|
|
907
|
+
safeValue: function(m) {
|
|
908
|
+
return c(m);
|
|
909
|
+
}
|
|
910
|
+
}, {
|
|
911
|
+
regex: this.regexp,
|
|
912
|
+
safeValue: function(m) {
|
|
913
|
+
return o.escapeValue ? c(o.escape(m)) : c(m);
|
|
914
|
+
}
|
|
915
|
+
}];
|
|
916
|
+
return v.forEach(function(g) {
|
|
917
|
+
for (l = 0; s = g.regex.exec(r); ) {
|
|
918
|
+
if (u = d(s[1].trim()), u === void 0)
|
|
919
|
+
if (typeof h == "function") {
|
|
920
|
+
var m = h(r, s, a);
|
|
921
|
+
u = typeof m == "string" ? m : "";
|
|
922
|
+
} else if (p) {
|
|
923
|
+
u = s[0];
|
|
924
|
+
continue;
|
|
925
|
+
} else
|
|
926
|
+
o.logger.warn("missed to pass in variable ".concat(s[1], " for interpolating ").concat(r)), u = "";
|
|
927
|
+
else
|
|
928
|
+
typeof u != "string" && !o.useRawValueToEscape && (u = ie(u));
|
|
929
|
+
if (r = r.replace(s[0], g.safeValue(u)), g.regex.lastIndex = 0, l++, l >= o.maxReplaces)
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
}), r;
|
|
933
|
+
}
|
|
934
|
+
}, {
|
|
935
|
+
key: "nest",
|
|
936
|
+
value: function(r, e) {
|
|
937
|
+
var t = this, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, o, s, u = x({}, a);
|
|
938
|
+
u.applyPostProcessor = !1, delete u.defaultValue;
|
|
939
|
+
function l(h, p) {
|
|
940
|
+
var v = this.nestingOptionsSeparator;
|
|
941
|
+
if (h.indexOf(v) < 0)
|
|
942
|
+
return h;
|
|
943
|
+
var g = h.split(new RegExp("".concat(v, "[ ]*{"))), m = "{".concat(g[1]);
|
|
944
|
+
h = g[0], m = this.interpolate(m, u), m = m.replace(/'/g, '"');
|
|
945
|
+
try {
|
|
946
|
+
u = JSON.parse(m), p && (u = x({}, p, u));
|
|
947
|
+
} catch (y) {
|
|
948
|
+
return this.logger.warn("failed parsing options string in nesting for key ".concat(h), y), "".concat(h).concat(v).concat(m);
|
|
949
|
+
}
|
|
950
|
+
return delete u.defaultValue, h;
|
|
951
|
+
}
|
|
952
|
+
for (; o = this.nestingRegexp.exec(r); ) {
|
|
953
|
+
var f = [], c = !1;
|
|
954
|
+
if (o[0].includes(this.formatSeparator) && !/{.*}/.test(o[1])) {
|
|
955
|
+
var d = o[1].split(this.formatSeparator).map(function(h) {
|
|
956
|
+
return h.trim();
|
|
957
|
+
});
|
|
958
|
+
o[1] = d.shift(), f = d, c = !0;
|
|
959
|
+
}
|
|
960
|
+
if (s = e(l.call(this, o[1].trim(), u), u), s && o[0] === r && typeof s != "string")
|
|
961
|
+
return s;
|
|
962
|
+
typeof s != "string" && (s = ie(s)), s || (this.logger.warn("missed to resolve ".concat(o[1], " for nesting ").concat(r)), s = ""), c && (s = f.reduce(function(h, p) {
|
|
963
|
+
return t.format(h, p, a.lng, a);
|
|
964
|
+
}, s.trim())), r = r.replace(o[0], s), this.regexp.lastIndex = 0;
|
|
965
|
+
}
|
|
966
|
+
return r;
|
|
967
|
+
}
|
|
968
|
+
}]), i;
|
|
969
|
+
}();
|
|
970
|
+
function Ae(i, n) {
|
|
971
|
+
for (var r = i.indexOf(n); r !== -1; )
|
|
972
|
+
i.splice(r, 1), r = i.indexOf(n);
|
|
973
|
+
}
|
|
974
|
+
var Ue = function(i) {
|
|
975
|
+
z(n, i);
|
|
976
|
+
function n(r, e, t) {
|
|
977
|
+
var a, o = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
978
|
+
return S(this, n), a = D(this, T(n).call(this)), J && R.call(N(a)), a.backend = r, a.store = e, a.services = t, a.languageUtils = t.languageUtils, a.options = o, a.logger = w.create("backendConnector"), a.state = {}, a.queue = [], a.backend && a.backend.init && a.backend.init(t, o.backend, o), a;
|
|
979
|
+
}
|
|
980
|
+
return O(n, [{
|
|
981
|
+
key: "queueLoad",
|
|
982
|
+
value: function(e, t, a, o) {
|
|
983
|
+
var s = this, u = [], l = [], f = [], c = [];
|
|
984
|
+
return e.forEach(function(d) {
|
|
985
|
+
var h = !0;
|
|
986
|
+
t.forEach(function(p) {
|
|
987
|
+
var v = "".concat(d, "|").concat(p);
|
|
988
|
+
!a.reload && s.store.hasResourceBundle(d, p) ? s.state[v] = 2 : s.state[v] < 0 || (s.state[v] === 1 ? l.indexOf(v) < 0 && l.push(v) : (s.state[v] = 1, h = !1, l.indexOf(v) < 0 && l.push(v), u.indexOf(v) < 0 && u.push(v), c.indexOf(p) < 0 && c.push(p)));
|
|
989
|
+
}), h || f.push(d);
|
|
990
|
+
}), (u.length || l.length) && this.queue.push({
|
|
991
|
+
pending: l,
|
|
992
|
+
loaded: {},
|
|
993
|
+
errors: [],
|
|
994
|
+
callback: o
|
|
995
|
+
}), {
|
|
996
|
+
toLoad: u,
|
|
997
|
+
pending: l,
|
|
998
|
+
toLoadLanguages: f,
|
|
999
|
+
toLoadNamespaces: c
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
}, {
|
|
1003
|
+
key: "loaded",
|
|
1004
|
+
value: function(e, t, a) {
|
|
1005
|
+
var o = e.split("|"), s = o[0], u = o[1];
|
|
1006
|
+
t && this.emit("failedLoading", s, u, t), a && this.store.addResourceBundle(s, u, a), this.state[e] = t ? -1 : 2;
|
|
1007
|
+
var l = {};
|
|
1008
|
+
this.queue.forEach(function(f) {
|
|
1009
|
+
Pe(f.loaded, [s], u), Ae(f.pending, e), t && f.errors.push(t), f.pending.length === 0 && !f.done && (Object.keys(f.loaded).forEach(function(c) {
|
|
1010
|
+
l[c] || (l[c] = []), f.loaded[c].length && f.loaded[c].forEach(function(d) {
|
|
1011
|
+
l[c].indexOf(d) < 0 && l[c].push(d);
|
|
1012
|
+
});
|
|
1013
|
+
}), f.done = !0, f.errors.length ? f.callback(f.errors) : f.callback());
|
|
1014
|
+
}), this.emit("loaded", l), this.queue = this.queue.filter(function(f) {
|
|
1015
|
+
return !f.done;
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
}, {
|
|
1019
|
+
key: "read",
|
|
1020
|
+
value: function(e, t, a) {
|
|
1021
|
+
var o = this, s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, u = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 350, l = arguments.length > 5 ? arguments[5] : void 0;
|
|
1022
|
+
return e.length ? this.backend[a](e, t, function(f, c) {
|
|
1023
|
+
if (f && c && s < 5) {
|
|
1024
|
+
setTimeout(function() {
|
|
1025
|
+
o.read.call(o, e, t, a, s + 1, u * 2, l);
|
|
1026
|
+
}, u);
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
l(f, c);
|
|
1030
|
+
}) : l(null, {});
|
|
1031
|
+
}
|
|
1032
|
+
}, {
|
|
1033
|
+
key: "prepareLoading",
|
|
1034
|
+
value: function(e, t) {
|
|
1035
|
+
var a = this, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = arguments.length > 3 ? arguments[3] : void 0;
|
|
1036
|
+
if (!this.backend)
|
|
1037
|
+
return this.logger.warn("No backend was added via i18next.use. Will not load resources."), s && s();
|
|
1038
|
+
typeof e == "string" && (e = this.languageUtils.toResolveHierarchy(e)), typeof t == "string" && (t = [t]);
|
|
1039
|
+
var u = this.queueLoad(e, t, o, s);
|
|
1040
|
+
if (!u.toLoad.length)
|
|
1041
|
+
return u.pending.length || s(), null;
|
|
1042
|
+
u.toLoad.forEach(function(l) {
|
|
1043
|
+
a.loadOne(l);
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
}, {
|
|
1047
|
+
key: "load",
|
|
1048
|
+
value: function(e, t, a) {
|
|
1049
|
+
this.prepareLoading(e, t, {}, a);
|
|
1050
|
+
}
|
|
1051
|
+
}, {
|
|
1052
|
+
key: "reload",
|
|
1053
|
+
value: function(e, t, a) {
|
|
1054
|
+
this.prepareLoading(e, t, {
|
|
1055
|
+
reload: !0
|
|
1056
|
+
}, a);
|
|
1057
|
+
}
|
|
1058
|
+
}, {
|
|
1059
|
+
key: "loadOne",
|
|
1060
|
+
value: function(e) {
|
|
1061
|
+
var t = this, a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", o = e.split("|"), s = o[0], u = o[1];
|
|
1062
|
+
this.read(s, u, "read", void 0, void 0, function(l, f) {
|
|
1063
|
+
l && t.logger.warn("".concat(a, "loading namespace ").concat(u, " for language ").concat(s, " failed"), l), !l && f && t.logger.log("".concat(a, "loaded namespace ").concat(u, " for language ").concat(s), f), t.loaded(e, l, f);
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
}, {
|
|
1067
|
+
key: "saveMissing",
|
|
1068
|
+
value: function(e, t, a, o, s) {
|
|
1069
|
+
var u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
|
|
1070
|
+
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(t)) {
|
|
1071
|
+
this.logger.warn('did not save key "'.concat(a, '" as the namespace "').concat(t, '" 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!!!");
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
a == null || a === "" || (this.backend && this.backend.create && this.backend.create(e, t, a, o, null, x({}, u, {
|
|
1075
|
+
isUpdate: s
|
|
1076
|
+
})), !(!e || !e[0]) && this.store.addResource(e[0], t, a, o));
|
|
1077
|
+
}
|
|
1078
|
+
}]), n;
|
|
1079
|
+
}(R);
|
|
1080
|
+
function De() {
|
|
1081
|
+
return {
|
|
1082
|
+
debug: !1,
|
|
1083
|
+
initImmediate: !0,
|
|
1084
|
+
ns: ["translation"],
|
|
1085
|
+
defaultNS: ["translation"],
|
|
1086
|
+
fallbackLng: ["dev"],
|
|
1087
|
+
fallbackNS: !1,
|
|
1088
|
+
whitelist: !1,
|
|
1089
|
+
nonExplicitWhitelist: !1,
|
|
1090
|
+
supportedLngs: !1,
|
|
1091
|
+
nonExplicitSupportedLngs: !1,
|
|
1092
|
+
load: "all",
|
|
1093
|
+
preload: !1,
|
|
1094
|
+
simplifyPluralSuffix: !0,
|
|
1095
|
+
keySeparator: ".",
|
|
1096
|
+
nsSeparator: ":",
|
|
1097
|
+
pluralSeparator: "_",
|
|
1098
|
+
contextSeparator: "_",
|
|
1099
|
+
partialBundledLanguages: !1,
|
|
1100
|
+
saveMissing: !1,
|
|
1101
|
+
updateMissing: !1,
|
|
1102
|
+
saveMissingTo: "fallback",
|
|
1103
|
+
saveMissingPlurals: !0,
|
|
1104
|
+
missingKeyHandler: !1,
|
|
1105
|
+
missingInterpolationHandler: !1,
|
|
1106
|
+
postProcess: !1,
|
|
1107
|
+
postProcessPassResolved: !1,
|
|
1108
|
+
returnNull: !0,
|
|
1109
|
+
returnEmptyString: !0,
|
|
1110
|
+
returnObjects: !1,
|
|
1111
|
+
joinArrays: !1,
|
|
1112
|
+
returnedObjectHandler: !1,
|
|
1113
|
+
parseMissingKeyHandler: !1,
|
|
1114
|
+
appendNamespaceToMissingKey: !1,
|
|
1115
|
+
appendNamespaceToCIMode: !1,
|
|
1116
|
+
overloadTranslationOptionHandler: function(n) {
|
|
1117
|
+
var r = {};
|
|
1118
|
+
if (F(n[1]) === "object" && (r = n[1]), typeof n[1] == "string" && (r.defaultValue = n[1]), typeof n[2] == "string" && (r.tDescription = n[2]), F(n[2]) === "object" || F(n[3]) === "object") {
|
|
1119
|
+
var e = n[3] || n[2];
|
|
1120
|
+
Object.keys(e).forEach(function(t) {
|
|
1121
|
+
r[t] = e[t];
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
return r;
|
|
1125
|
+
},
|
|
1126
|
+
interpolation: {
|
|
1127
|
+
escapeValue: !0,
|
|
1128
|
+
format: function(n, r, e, t) {
|
|
1129
|
+
return n;
|
|
1130
|
+
},
|
|
1131
|
+
prefix: "{{",
|
|
1132
|
+
suffix: "}}",
|
|
1133
|
+
formatSeparator: ",",
|
|
1134
|
+
unescapePrefix: "-",
|
|
1135
|
+
nestingPrefix: "$t(",
|
|
1136
|
+
nestingSuffix: ")",
|
|
1137
|
+
nestingOptionsSeparator: ",",
|
|
1138
|
+
maxReplaces: 1e3,
|
|
1139
|
+
skipOnVariables: !1
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
function fe(i) {
|
|
1144
|
+
return typeof i.ns == "string" && (i.ns = [i.ns]), typeof i.fallbackLng == "string" && (i.fallbackLng = [i.fallbackLng]), typeof i.fallbackNS == "string" && (i.fallbackNS = [i.fallbackNS]), i.whitelist && (i.whitelist && i.whitelist.indexOf("cimode") < 0 && (i.whitelist = i.whitelist.concat(["cimode"])), i.supportedLngs = i.whitelist), i.nonExplicitWhitelist && (i.nonExplicitSupportedLngs = i.nonExplicitWhitelist), i.supportedLngs && i.supportedLngs.indexOf("cimode") < 0 && (i.supportedLngs = i.supportedLngs.concat(["cimode"])), i;
|
|
1145
|
+
}
|
|
1146
|
+
function M() {
|
|
1147
|
+
}
|
|
1148
|
+
var He = function(i) {
|
|
1149
|
+
z(n, i);
|
|
1150
|
+
function n() {
|
|
1151
|
+
var r, e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
1152
|
+
if (S(this, n), r = D(this, T(n).call(this)), J && R.call(N(r)), r.options = fe(e), r.services = {}, r.logger = w, r.modules = {
|
|
1153
|
+
external: []
|
|
1154
|
+
}, t && !r.isInitialized && !e.isClone) {
|
|
1155
|
+
if (!r.options.initImmediate)
|
|
1156
|
+
return r.init(e, t), D(r, N(r));
|
|
1157
|
+
setTimeout(function() {
|
|
1158
|
+
r.init(e, t);
|
|
1159
|
+
}, 0);
|
|
1160
|
+
}
|
|
1161
|
+
return r;
|
|
1162
|
+
}
|
|
1163
|
+
return O(n, [{
|
|
1164
|
+
key: "init",
|
|
1165
|
+
value: function() {
|
|
1166
|
+
var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, a = arguments.length > 1 ? arguments[1] : void 0;
|
|
1167
|
+
typeof t == "function" && (a = t, t = {}), t.whitelist && !t.supportedLngs && this.logger.deprecate("whitelist", 'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'), t.nonExplicitWhitelist && !t.nonExplicitSupportedLngs && this.logger.deprecate("whitelist", 'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'), this.options = x({}, De(), this.options, fe(t)), this.format = this.options.interpolation.format, a || (a = M);
|
|
1168
|
+
function o(h) {
|
|
1169
|
+
return h ? typeof h == "function" ? new h() : h : null;
|
|
1170
|
+
}
|
|
1171
|
+
if (!this.options.isClone) {
|
|
1172
|
+
this.modules.logger ? w.init(o(this.modules.logger), this.options) : w.init(null, this.options);
|
|
1173
|
+
var s = new je(this.options);
|
|
1174
|
+
this.store = new Ee(this.options.resources, this.options);
|
|
1175
|
+
var u = this.services;
|
|
1176
|
+
u.logger = w, u.resourceStore = this.store, u.languageUtils = s, u.pluralResolver = new Ve(s, {
|
|
1177
|
+
prepend: this.options.pluralSeparator,
|
|
1178
|
+
compatibilityJSON: this.options.compatibilityJSON,
|
|
1179
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1180
|
+
}), u.interpolator = new Ie(this.options), u.utils = {
|
|
1181
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1182
|
+
}, u.backendConnector = new Ue(o(this.modules.backend), u.resourceStore, u, this.options), u.backendConnector.on("*", function(h) {
|
|
1183
|
+
for (var p = arguments.length, v = new Array(p > 1 ? p - 1 : 0), g = 1; g < p; g++)
|
|
1184
|
+
v[g - 1] = arguments[g];
|
|
1185
|
+
e.emit.apply(e, [h].concat(v));
|
|
1186
|
+
}), this.modules.languageDetector && (u.languageDetector = o(this.modules.languageDetector), u.languageDetector.init(u, this.options.detection, this.options)), this.modules.i18nFormat && (u.i18nFormat = o(this.modules.i18nFormat), u.i18nFormat.init && u.i18nFormat.init(this)), this.translator = new le(this.services, this.options), this.translator.on("*", function(h) {
|
|
1187
|
+
for (var p = arguments.length, v = new Array(p > 1 ? p - 1 : 0), g = 1; g < p; g++)
|
|
1188
|
+
v[g - 1] = arguments[g];
|
|
1189
|
+
e.emit.apply(e, [h].concat(v));
|
|
1190
|
+
}), this.modules.external.forEach(function(h) {
|
|
1191
|
+
h.init && h.init(e);
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
!this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined");
|
|
1195
|
+
var l = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
|
|
1196
|
+
l.forEach(function(h) {
|
|
1197
|
+
e[h] = function() {
|
|
1198
|
+
var p;
|
|
1199
|
+
return (p = e.store)[h].apply(p, arguments);
|
|
1200
|
+
};
|
|
1201
|
+
});
|
|
1202
|
+
var f = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
|
|
1203
|
+
f.forEach(function(h) {
|
|
1204
|
+
e[h] = function() {
|
|
1205
|
+
var p;
|
|
1206
|
+
return (p = e.store)[h].apply(p, arguments), e;
|
|
1207
|
+
};
|
|
1208
|
+
});
|
|
1209
|
+
var c = U(), d = function() {
|
|
1210
|
+
e.changeLanguage(e.options.lng, function(p, v) {
|
|
1211
|
+
e.isInitialized = !0, e.options.isClone || e.logger.log("initialized", e.options), e.emit("initialized", e.options), c.resolve(v), a(p, v);
|
|
1212
|
+
});
|
|
1213
|
+
};
|
|
1214
|
+
return this.options.resources || !this.options.initImmediate ? d() : setTimeout(d, 0), c;
|
|
1215
|
+
}
|
|
1216
|
+
}, {
|
|
1217
|
+
key: "loadResources",
|
|
1218
|
+
value: function(e) {
|
|
1219
|
+
var t = this, a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : M, o = a, s = typeof e == "string" ? e : this.language;
|
|
1220
|
+
if (typeof e == "function" && (o = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1221
|
+
if (s && s.toLowerCase() === "cimode")
|
|
1222
|
+
return o();
|
|
1223
|
+
var u = [], l = function(d) {
|
|
1224
|
+
if (d) {
|
|
1225
|
+
var h = t.services.languageUtils.toResolveHierarchy(d);
|
|
1226
|
+
h.forEach(function(p) {
|
|
1227
|
+
u.indexOf(p) < 0 && u.push(p);
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
if (s)
|
|
1232
|
+
l(s);
|
|
1233
|
+
else {
|
|
1234
|
+
var f = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1235
|
+
f.forEach(function(c) {
|
|
1236
|
+
return l(c);
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
this.options.preload && this.options.preload.forEach(function(c) {
|
|
1240
|
+
return l(c);
|
|
1241
|
+
}), this.services.backendConnector.load(u, this.options.ns, o);
|
|
1242
|
+
} else
|
|
1243
|
+
o(null);
|
|
1244
|
+
}
|
|
1245
|
+
}, {
|
|
1246
|
+
key: "reloadResources",
|
|
1247
|
+
value: function(e, t, a) {
|
|
1248
|
+
var o = U();
|
|
1249
|
+
return e || (e = this.languages), t || (t = this.options.ns), a || (a = M), this.services.backendConnector.reload(e, t, function(s) {
|
|
1250
|
+
o.resolve(), a(s);
|
|
1251
|
+
}), o;
|
|
1252
|
+
}
|
|
1253
|
+
}, {
|
|
1254
|
+
key: "use",
|
|
1255
|
+
value: function(e) {
|
|
1256
|
+
if (!e)
|
|
1257
|
+
throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1258
|
+
if (!e.type)
|
|
1259
|
+
throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1260
|
+
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" && ge.addPostProcessor(e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1261
|
+
}
|
|
1262
|
+
}, {
|
|
1263
|
+
key: "changeLanguage",
|
|
1264
|
+
value: function(e, t) {
|
|
1265
|
+
var a = this;
|
|
1266
|
+
this.isLanguageChangingTo = e;
|
|
1267
|
+
var o = U();
|
|
1268
|
+
this.emit("languageChanging", e);
|
|
1269
|
+
var s = function(f, c) {
|
|
1270
|
+
c ? (a.language = c, a.languages = a.services.languageUtils.toResolveHierarchy(c), a.translator.changeLanguage(c), a.isLanguageChangingTo = void 0, a.emit("languageChanged", c), a.logger.log("languageChanged", c)) : a.isLanguageChangingTo = void 0, o.resolve(function() {
|
|
1271
|
+
return a.t.apply(a, arguments);
|
|
1272
|
+
}), t && t(f, function() {
|
|
1273
|
+
return a.t.apply(a, arguments);
|
|
1274
|
+
});
|
|
1275
|
+
}, u = function(f) {
|
|
1276
|
+
var c = typeof f == "string" ? f : a.services.languageUtils.getBestMatchFromCodes(f);
|
|
1277
|
+
c && (a.language || (a.language = c, a.languages = a.services.languageUtils.toResolveHierarchy(c)), a.translator.language || a.translator.changeLanguage(c), a.services.languageDetector && a.services.languageDetector.cacheUserLanguage(c)), a.loadResources(c, function(d) {
|
|
1278
|
+
s(d, c);
|
|
1279
|
+
});
|
|
1280
|
+
};
|
|
1281
|
+
return !e && this.services.languageDetector && !this.services.languageDetector.async ? u(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect(u) : u(e), o;
|
|
1282
|
+
}
|
|
1283
|
+
}, {
|
|
1284
|
+
key: "getFixedT",
|
|
1285
|
+
value: function(e, t) {
|
|
1286
|
+
var a = this, o = function s(u, l) {
|
|
1287
|
+
var f;
|
|
1288
|
+
if (F(l) !== "object") {
|
|
1289
|
+
for (var c = arguments.length, d = new Array(c > 2 ? c - 2 : 0), h = 2; h < c; h++)
|
|
1290
|
+
d[h - 2] = arguments[h];
|
|
1291
|
+
f = a.options.overloadTranslationOptionHandler([u, l].concat(d));
|
|
1292
|
+
} else
|
|
1293
|
+
f = x({}, l);
|
|
1294
|
+
return f.lng = f.lng || s.lng, f.lngs = f.lngs || s.lngs, f.ns = f.ns || s.ns, a.t(u, f);
|
|
1295
|
+
};
|
|
1296
|
+
return typeof e == "string" ? o.lng = e : o.lngs = e, o.ns = t, o;
|
|
1297
|
+
}
|
|
1298
|
+
}, {
|
|
1299
|
+
key: "t",
|
|
1300
|
+
value: function() {
|
|
1301
|
+
var e;
|
|
1302
|
+
return this.translator && (e = this.translator).translate.apply(e, arguments);
|
|
1303
|
+
}
|
|
1304
|
+
}, {
|
|
1305
|
+
key: "exists",
|
|
1306
|
+
value: function() {
|
|
1307
|
+
var e;
|
|
1308
|
+
return this.translator && (e = this.translator).exists.apply(e, arguments);
|
|
1309
|
+
}
|
|
1310
|
+
}, {
|
|
1311
|
+
key: "setDefaultNamespace",
|
|
1312
|
+
value: function(e) {
|
|
1313
|
+
this.options.defaultNS = e;
|
|
1314
|
+
}
|
|
1315
|
+
}, {
|
|
1316
|
+
key: "hasLoadedNamespace",
|
|
1317
|
+
value: function(e) {
|
|
1318
|
+
var t = this, a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1319
|
+
if (!this.isInitialized)
|
|
1320
|
+
return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
|
|
1321
|
+
if (!this.languages || !this.languages.length)
|
|
1322
|
+
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1323
|
+
var o = this.languages[0], s = this.options ? this.options.fallbackLng : !1, u = this.languages[this.languages.length - 1];
|
|
1324
|
+
if (o.toLowerCase() === "cimode")
|
|
1325
|
+
return !0;
|
|
1326
|
+
var l = function(d, h) {
|
|
1327
|
+
var p = t.services.backendConnector.state["".concat(d, "|").concat(h)];
|
|
1328
|
+
return p === -1 || p === 2;
|
|
1329
|
+
};
|
|
1330
|
+
if (a.precheck) {
|
|
1331
|
+
var f = a.precheck(this, l);
|
|
1332
|
+
if (f !== void 0)
|
|
1333
|
+
return f;
|
|
1334
|
+
}
|
|
1335
|
+
return !!(this.hasResourceBundle(o, e) || !this.services.backendConnector.backend || l(o, e) && (!s || l(u, e)));
|
|
1336
|
+
}
|
|
1337
|
+
}, {
|
|
1338
|
+
key: "loadNamespaces",
|
|
1339
|
+
value: function(e, t) {
|
|
1340
|
+
var a = this, o = U();
|
|
1341
|
+
return this.options.ns ? (typeof e == "string" && (e = [e]), e.forEach(function(s) {
|
|
1342
|
+
a.options.ns.indexOf(s) < 0 && a.options.ns.push(s);
|
|
1343
|
+
}), this.loadResources(function(s) {
|
|
1344
|
+
o.resolve(), t && t(s);
|
|
1345
|
+
}), o) : (t && t(), Promise.resolve());
|
|
1346
|
+
}
|
|
1347
|
+
}, {
|
|
1348
|
+
key: "loadLanguages",
|
|
1349
|
+
value: function(e, t) {
|
|
1350
|
+
var a = U();
|
|
1351
|
+
typeof e == "string" && (e = [e]);
|
|
1352
|
+
var o = this.options.preload || [], s = e.filter(function(u) {
|
|
1353
|
+
return o.indexOf(u) < 0;
|
|
1354
|
+
});
|
|
1355
|
+
return s.length ? (this.options.preload = o.concat(s), this.loadResources(function(u) {
|
|
1356
|
+
a.resolve(), t && t(u);
|
|
1357
|
+
}), a) : (t && t(), Promise.resolve());
|
|
1358
|
+
}
|
|
1359
|
+
}, {
|
|
1360
|
+
key: "dir",
|
|
1361
|
+
value: function(e) {
|
|
1362
|
+
if (e || (e = this.languages && this.languages.length > 0 ? this.languages[0] : this.language), !e)
|
|
1363
|
+
return "rtl";
|
|
1364
|
+
var 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"];
|
|
1365
|
+
return t.indexOf(this.services.languageUtils.getLanguagePartFromCode(e)) >= 0 ? "rtl" : "ltr";
|
|
1366
|
+
}
|
|
1367
|
+
}, {
|
|
1368
|
+
key: "createInstance",
|
|
1369
|
+
value: function() {
|
|
1370
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
|
|
1371
|
+
return new n(e, t);
|
|
1372
|
+
}
|
|
1373
|
+
}, {
|
|
1374
|
+
key: "cloneInstance",
|
|
1375
|
+
value: function() {
|
|
1376
|
+
var e = this, t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : M, o = x({}, this.options, t, {
|
|
1377
|
+
isClone: !0
|
|
1378
|
+
}), s = new n(o), u = ["store", "services", "language"];
|
|
1379
|
+
return u.forEach(function(l) {
|
|
1380
|
+
s[l] = e[l];
|
|
1381
|
+
}), s.services = x({}, this.services), s.services.utils = {
|
|
1382
|
+
hasLoadedNamespace: s.hasLoadedNamespace.bind(s)
|
|
1383
|
+
}, s.translator = new le(s.services, s.options), s.translator.on("*", function(l) {
|
|
1384
|
+
for (var f = arguments.length, c = new Array(f > 1 ? f - 1 : 0), d = 1; d < f; d++)
|
|
1385
|
+
c[d - 1] = arguments[d];
|
|
1386
|
+
s.emit.apply(s, [l].concat(c));
|
|
1387
|
+
}), s.init(o, a), s.translator.options = s.options, s.translator.backendConnector.services.utils = {
|
|
1388
|
+
hasLoadedNamespace: s.hasLoadedNamespace.bind(s)
|
|
1389
|
+
}, s;
|
|
1390
|
+
}
|
|
1391
|
+
}]), n;
|
|
1392
|
+
}(R), Q = new He();
|
|
1393
|
+
const Ke = {
|
|
1394
|
+
en: me,
|
|
1395
|
+
tr: ye
|
|
1396
|
+
};
|
|
1397
|
+
Q.use(Se).init(
|
|
1398
|
+
{
|
|
1399
|
+
resources: Ke,
|
|
1400
|
+
lng: "en",
|
|
1401
|
+
react: {
|
|
1402
|
+
useSuspense: !0,
|
|
1403
|
+
transSupportBasicHtmlNodes: !0,
|
|
1404
|
+
transKeepBasicHtmlNodesFor: ["i"]
|
|
1405
|
+
},
|
|
1406
|
+
keySeperator: !1,
|
|
1407
|
+
interpolation: {
|
|
1408
|
+
escapeValue: !1
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
ve
|
|
1412
|
+
);
|
|
1413
|
+
const $e = Q.t.bind(Q);
|
|
1414
|
+
export {
|
|
1415
|
+
Q as default,
|
|
1416
|
+
$e as t
|
|
1417
|
+
};
|