i18next 21.4.2 → 21.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/i18next.js +96 -45
- package/dist/esm/i18next.bundled.js +141 -62
- package/dist/esm/i18next.js +109 -43
- package/dist/esm/package.json +1 -0
- package/dist/umd/i18next.js +120 -88
- package/dist/umd/i18next.min.js +1 -1
- package/i18next.js +120 -88
- package/i18next.min.js +1 -1
- package/package.json +16 -10
- package/CHANGELOG.md +0 -1431
package/dist/umd/i18next.js
CHANGED
|
@@ -20,40 +20,6 @@
|
|
|
20
20
|
return _typeof(obj);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function _defineProperty(obj, key, value) {
|
|
24
|
-
if (key in obj) {
|
|
25
|
-
Object.defineProperty(obj, key, {
|
|
26
|
-
value: value,
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
obj[key] = value;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return obj;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _objectSpread(target) {
|
|
39
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
40
|
-
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
41
|
-
var ownKeys = Object.keys(source);
|
|
42
|
-
|
|
43
|
-
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
44
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
45
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
ownKeys.forEach(function (key) {
|
|
50
|
-
_defineProperty(target, key, source[key]);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return target;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
23
|
function _classCallCheck(instance, Constructor) {
|
|
58
24
|
if (!(instance instanceof Constructor)) {
|
|
59
25
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -84,21 +50,6 @@
|
|
|
84
50
|
return self;
|
|
85
51
|
}
|
|
86
52
|
|
|
87
|
-
function _possibleConstructorReturn(self, call) {
|
|
88
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
89
|
-
return call;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return _assertThisInitialized(self);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function _getPrototypeOf(o) {
|
|
96
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
97
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
98
|
-
};
|
|
99
|
-
return _getPrototypeOf(o);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
53
|
function _setPrototypeOf(o, p) {
|
|
103
54
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
104
55
|
o.__proto__ = p;
|
|
@@ -123,6 +74,40 @@
|
|
|
123
74
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
124
75
|
}
|
|
125
76
|
|
|
77
|
+
function _possibleConstructorReturn(self, call) {
|
|
78
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
79
|
+
return call;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return _assertThisInitialized(self);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function _getPrototypeOf(o) {
|
|
86
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
87
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
88
|
+
};
|
|
89
|
+
return _getPrototypeOf(o);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function _defineProperty(obj, key, value) {
|
|
93
|
+
if (key in obj) {
|
|
94
|
+
Object.defineProperty(obj, key, {
|
|
95
|
+
value: value,
|
|
96
|
+
enumerable: true,
|
|
97
|
+
configurable: true,
|
|
98
|
+
writable: true
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
obj[key] = value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return obj;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
108
|
+
|
|
109
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
110
|
+
|
|
126
111
|
var consoleLogger = {
|
|
127
112
|
type: 'logger',
|
|
128
113
|
log: function log(args) {
|
|
@@ -208,9 +193,9 @@
|
|
|
208
193
|
}, {
|
|
209
194
|
key: "create",
|
|
210
195
|
value: function create(moduleName) {
|
|
211
|
-
return new Logger(this.logger, _objectSpread({}, {
|
|
196
|
+
return new Logger(this.logger, _objectSpread(_objectSpread({}, {
|
|
212
197
|
prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
|
|
213
|
-
}, this.options));
|
|
198
|
+
}), this.options));
|
|
214
199
|
}
|
|
215
200
|
}]);
|
|
216
201
|
|
|
@@ -425,6 +410,14 @@
|
|
|
425
410
|
return matched;
|
|
426
411
|
}
|
|
427
412
|
|
|
413
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
414
|
+
|
|
415
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
416
|
+
|
|
417
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
418
|
+
|
|
419
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
420
|
+
|
|
428
421
|
function deepFind(obj, path) {
|
|
429
422
|
var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
430
423
|
if (!obj) return undefined;
|
|
@@ -467,6 +460,8 @@
|
|
|
467
460
|
var ResourceStore = function (_EventEmitter) {
|
|
468
461
|
_inherits(ResourceStore, _EventEmitter);
|
|
469
462
|
|
|
463
|
+
var _super = _createSuper(ResourceStore);
|
|
464
|
+
|
|
470
465
|
function ResourceStore(data) {
|
|
471
466
|
var _this;
|
|
472
467
|
|
|
@@ -477,7 +472,7 @@
|
|
|
477
472
|
|
|
478
473
|
_classCallCheck(this, ResourceStore);
|
|
479
474
|
|
|
480
|
-
_this =
|
|
475
|
+
_this = _super.call(this);
|
|
481
476
|
|
|
482
477
|
if (isIE10) {
|
|
483
478
|
EventEmitter.call(_assertThisInitialized(_this));
|
|
@@ -588,7 +583,7 @@
|
|
|
588
583
|
if (deep) {
|
|
589
584
|
deepExtend(pack, resources, overwrite);
|
|
590
585
|
} else {
|
|
591
|
-
pack = _objectSpread({}, pack, resources);
|
|
586
|
+
pack = _objectSpread$1(_objectSpread$1({}, pack), resources);
|
|
592
587
|
}
|
|
593
588
|
|
|
594
589
|
setPath(this.data, path, pack);
|
|
@@ -613,7 +608,7 @@
|
|
|
613
608
|
key: "getResourceBundle",
|
|
614
609
|
value: function getResourceBundle(lng, ns) {
|
|
615
610
|
if (!ns) ns = this.options.defaultNS;
|
|
616
|
-
if (this.options.compatibilityAPI === 'v1') return _objectSpread({}, {}, this.getResource(lng, ns));
|
|
611
|
+
if (this.options.compatibilityAPI === 'v1') return _objectSpread$1(_objectSpread$1({}, {}), this.getResource(lng, ns));
|
|
617
612
|
return this.getResource(lng, ns);
|
|
618
613
|
}
|
|
619
614
|
}, {
|
|
@@ -655,11 +650,20 @@
|
|
|
655
650
|
}
|
|
656
651
|
};
|
|
657
652
|
|
|
653
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
654
|
+
|
|
655
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
656
|
+
|
|
657
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
658
|
+
|
|
659
|
+
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
658
660
|
var checkedLoadedFor = {};
|
|
659
661
|
|
|
660
662
|
var Translator = function (_EventEmitter) {
|
|
661
663
|
_inherits(Translator, _EventEmitter);
|
|
662
664
|
|
|
665
|
+
var _super = _createSuper$1(Translator);
|
|
666
|
+
|
|
663
667
|
function Translator(services) {
|
|
664
668
|
var _this;
|
|
665
669
|
|
|
@@ -667,7 +671,7 @@
|
|
|
667
671
|
|
|
668
672
|
_classCallCheck(this, Translator);
|
|
669
673
|
|
|
670
|
-
_this =
|
|
674
|
+
_this = _super.call(this);
|
|
671
675
|
|
|
672
676
|
if (isIE10) {
|
|
673
677
|
EventEmitter.call(_assertThisInitialized(_this));
|
|
@@ -781,7 +785,7 @@
|
|
|
781
785
|
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
782
786
|
}
|
|
783
787
|
|
|
784
|
-
return this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread({}, options, {
|
|
788
|
+
return this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$2(_objectSpread$2({}, options), {}, {
|
|
785
789
|
ns: namespaces
|
|
786
790
|
})) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
|
|
787
791
|
}
|
|
@@ -794,7 +798,7 @@
|
|
|
794
798
|
for (var m in res) {
|
|
795
799
|
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
796
800
|
var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m);
|
|
797
|
-
copy[m] = this.translate(deepKey, _objectSpread({}, options, {
|
|
801
|
+
copy[m] = this.translate(deepKey, _objectSpread$2(_objectSpread$2({}, options), {
|
|
798
802
|
joinArrays: false,
|
|
799
803
|
ns: namespaces
|
|
800
804
|
}));
|
|
@@ -833,7 +837,7 @@
|
|
|
833
837
|
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
834
838
|
|
|
835
839
|
if (keySeparator) {
|
|
836
|
-
var fk = this.resolve(key, _objectSpread({}, options, {
|
|
840
|
+
var fk = this.resolve(key, _objectSpread$2(_objectSpread$2({}, options), {}, {
|
|
837
841
|
keySeparator: false
|
|
838
842
|
}));
|
|
839
843
|
if (fk && fk.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.');
|
|
@@ -892,8 +896,8 @@
|
|
|
892
896
|
resolved: resolved
|
|
893
897
|
});
|
|
894
898
|
} else if (!options.skipInterpolation) {
|
|
895
|
-
if (options.interpolation) this.interpolator.init(_objectSpread({}, options, {
|
|
896
|
-
interpolation: _objectSpread({}, this.options.interpolation, options.interpolation)
|
|
899
|
+
if (options.interpolation) this.interpolator.init(_objectSpread$2(_objectSpread$2({}, options), {
|
|
900
|
+
interpolation: _objectSpread$2(_objectSpread$2({}, this.options.interpolation), options.interpolation)
|
|
897
901
|
}));
|
|
898
902
|
var skipOnVariables = options.interpolation && options.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables;
|
|
899
903
|
var nestBef;
|
|
@@ -904,7 +908,7 @@
|
|
|
904
908
|
}
|
|
905
909
|
|
|
906
910
|
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
907
|
-
if (this.options.interpolation.defaultVariables) data = _objectSpread({}, this.options.interpolation.defaultVariables, data);
|
|
911
|
+
if (this.options.interpolation.defaultVariables) data = _objectSpread$2(_objectSpread$2({}, this.options.interpolation.defaultVariables), data);
|
|
908
912
|
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
909
913
|
|
|
910
914
|
if (skipOnVariables) {
|
|
@@ -933,7 +937,7 @@
|
|
|
933
937
|
var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
934
938
|
|
|
935
939
|
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
936
|
-
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread({
|
|
940
|
+
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$2({
|
|
937
941
|
i18nResolved: resolved
|
|
938
942
|
}, options) : options, this);
|
|
939
943
|
}
|
|
@@ -1515,6 +1519,10 @@
|
|
|
1515
1519
|
return PluralResolver;
|
|
1516
1520
|
}();
|
|
1517
1521
|
|
|
1522
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1523
|
+
|
|
1524
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1525
|
+
|
|
1518
1526
|
var Interpolator = function () {
|
|
1519
1527
|
function Interpolator() {
|
|
1520
1528
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -1586,7 +1594,7 @@
|
|
|
1586
1594
|
var handleFormat = function handleFormat(key) {
|
|
1587
1595
|
if (key.indexOf(_this.formatSeparator) < 0) {
|
|
1588
1596
|
var path = getPathWithDefaults(data, defaultData, key);
|
|
1589
|
-
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread({}, options, data, {
|
|
1597
|
+
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
1590
1598
|
interpolationkey: key
|
|
1591
1599
|
})) : path;
|
|
1592
1600
|
}
|
|
@@ -1594,7 +1602,7 @@
|
|
|
1594
1602
|
var p = key.split(_this.formatSeparator);
|
|
1595
1603
|
var k = p.shift().trim();
|
|
1596
1604
|
var f = p.join(_this.formatSeparator).trim();
|
|
1597
|
-
return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread({}, options, data, {
|
|
1605
|
+
return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
1598
1606
|
interpolationkey: k
|
|
1599
1607
|
}));
|
|
1600
1608
|
};
|
|
@@ -1663,7 +1671,7 @@
|
|
|
1663
1671
|
var match;
|
|
1664
1672
|
var value;
|
|
1665
1673
|
|
|
1666
|
-
var clonedOptions = _objectSpread({}, options);
|
|
1674
|
+
var clonedOptions = _objectSpread$3({}, options);
|
|
1667
1675
|
|
|
1668
1676
|
clonedOptions.applyPostProcessor = false;
|
|
1669
1677
|
delete clonedOptions.defaultValue;
|
|
@@ -1679,7 +1687,7 @@
|
|
|
1679
1687
|
|
|
1680
1688
|
try {
|
|
1681
1689
|
clonedOptions = JSON.parse(optionsString);
|
|
1682
|
-
if (inheritedOptions) clonedOptions = _objectSpread({}, inheritedOptions, clonedOptions);
|
|
1690
|
+
if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
|
|
1683
1691
|
} catch (e) {
|
|
1684
1692
|
this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
|
|
1685
1693
|
return "".concat(key).concat(sep).concat(optionsString);
|
|
@@ -1713,7 +1721,7 @@
|
|
|
1713
1721
|
|
|
1714
1722
|
if (doReduce) {
|
|
1715
1723
|
value = formatters.reduce(function (v, f) {
|
|
1716
|
-
return _this2.format(v, f, options.lng, _objectSpread({}, options, {
|
|
1724
|
+
return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
1717
1725
|
interpolationkey: match[1].trim()
|
|
1718
1726
|
}));
|
|
1719
1727
|
}, value.trim());
|
|
@@ -1788,6 +1796,10 @@
|
|
|
1788
1796
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1789
1797
|
}
|
|
1790
1798
|
|
|
1799
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1800
|
+
|
|
1801
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1802
|
+
|
|
1791
1803
|
function parseFormatStr(formatStr) {
|
|
1792
1804
|
var formatName = formatStr.toLowerCase().trim();
|
|
1793
1805
|
var formatOptions = {};
|
|
@@ -1838,18 +1850,18 @@
|
|
|
1838
1850
|
return new Intl.NumberFormat(lng, options).format(val);
|
|
1839
1851
|
},
|
|
1840
1852
|
currency: function currency(val, lng, options) {
|
|
1841
|
-
return new Intl.NumberFormat(lng, _objectSpread({}, options, {
|
|
1853
|
+
return new Intl.NumberFormat(lng, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
1842
1854
|
style: 'currency'
|
|
1843
1855
|
})).format(val);
|
|
1844
1856
|
},
|
|
1845
1857
|
datetime: function datetime(val, lng, options) {
|
|
1846
|
-
return new Intl.DateTimeFormat(lng, _objectSpread({}, options)).format(val);
|
|
1858
|
+
return new Intl.DateTimeFormat(lng, _objectSpread$4({}, options)).format(val);
|
|
1847
1859
|
},
|
|
1848
1860
|
relativetime: function relativetime(val, lng, options) {
|
|
1849
|
-
return new Intl.RelativeTimeFormat(lng, _objectSpread({}, options)).format(val, options.range || 'day');
|
|
1861
|
+
return new Intl.RelativeTimeFormat(lng, _objectSpread$4({}, options)).format(val, options.range || 'day');
|
|
1850
1862
|
},
|
|
1851
1863
|
list: function list(val, lng, options) {
|
|
1852
|
-
return new Intl.ListFormat(lng, _objectSpread({}, options)).format(val);
|
|
1864
|
+
return new Intl.ListFormat(lng, _objectSpread$4({}, options)).format(val);
|
|
1853
1865
|
}
|
|
1854
1866
|
};
|
|
1855
1867
|
this.init(options);
|
|
@@ -1887,7 +1899,7 @@
|
|
|
1887
1899
|
try {
|
|
1888
1900
|
var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
|
|
1889
1901
|
var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
1890
|
-
formatted = _this.formats[formatName](mem, l, _objectSpread({}, formatOptions, options, valOptions));
|
|
1902
|
+
formatted = _this.formats[formatName](mem, l, _objectSpread$4(_objectSpread$4(_objectSpread$4({}, formatOptions), options), valOptions));
|
|
1891
1903
|
} catch (error) {
|
|
1892
1904
|
_this.logger.warn(error);
|
|
1893
1905
|
}
|
|
@@ -1906,6 +1918,14 @@
|
|
|
1906
1918
|
return Formatter;
|
|
1907
1919
|
}();
|
|
1908
1920
|
|
|
1921
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1922
|
+
|
|
1923
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1924
|
+
|
|
1925
|
+
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1926
|
+
|
|
1927
|
+
function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1928
|
+
|
|
1909
1929
|
function remove(arr, what) {
|
|
1910
1930
|
var found = arr.indexOf(what);
|
|
1911
1931
|
|
|
@@ -1918,6 +1938,8 @@
|
|
|
1918
1938
|
var Connector = function (_EventEmitter) {
|
|
1919
1939
|
_inherits(Connector, _EventEmitter);
|
|
1920
1940
|
|
|
1941
|
+
var _super = _createSuper$2(Connector);
|
|
1942
|
+
|
|
1921
1943
|
function Connector(backend, store, services) {
|
|
1922
1944
|
var _this;
|
|
1923
1945
|
|
|
@@ -1925,7 +1947,7 @@
|
|
|
1925
1947
|
|
|
1926
1948
|
_classCallCheck(this, Connector);
|
|
1927
1949
|
|
|
1928
|
-
_this =
|
|
1950
|
+
_this = _super.call(this);
|
|
1929
1951
|
|
|
1930
1952
|
if (isIE10) {
|
|
1931
1953
|
EventEmitter.call(_assertThisInitialized(_this));
|
|
@@ -2122,7 +2144,7 @@
|
|
|
2122
2144
|
if (key === undefined || key === null || key === '') return;
|
|
2123
2145
|
|
|
2124
2146
|
if (this.backend && this.backend.create) {
|
|
2125
|
-
this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread({}, options, {
|
|
2147
|
+
this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5(_objectSpread$5({}, options), {}, {
|
|
2126
2148
|
isUpdate: isUpdate
|
|
2127
2149
|
}));
|
|
2128
2150
|
}
|
|
@@ -2213,6 +2235,14 @@
|
|
|
2213
2235
|
return options;
|
|
2214
2236
|
}
|
|
2215
2237
|
|
|
2238
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2239
|
+
|
|
2240
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2241
|
+
|
|
2242
|
+
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2243
|
+
|
|
2244
|
+
function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2245
|
+
|
|
2216
2246
|
function noop() {}
|
|
2217
2247
|
|
|
2218
2248
|
function bindMemberFunctions(inst) {
|
|
@@ -2227,6 +2257,8 @@
|
|
|
2227
2257
|
var I18n = function (_EventEmitter) {
|
|
2228
2258
|
_inherits(I18n, _EventEmitter);
|
|
2229
2259
|
|
|
2260
|
+
var _super = _createSuper$3(I18n);
|
|
2261
|
+
|
|
2230
2262
|
function I18n() {
|
|
2231
2263
|
var _this;
|
|
2232
2264
|
|
|
@@ -2235,7 +2267,7 @@
|
|
|
2235
2267
|
|
|
2236
2268
|
_classCallCheck(this, I18n);
|
|
2237
2269
|
|
|
2238
|
-
_this =
|
|
2270
|
+
_this = _super.call(this);
|
|
2239
2271
|
|
|
2240
2272
|
if (isIE10) {
|
|
2241
2273
|
EventEmitter.call(_assertThisInitialized(_this));
|
|
@@ -2286,7 +2318,7 @@
|
|
|
2286
2318
|
}
|
|
2287
2319
|
|
|
2288
2320
|
var defOpts = get();
|
|
2289
|
-
this.options = _objectSpread({}, defOpts, this.options, transformOptions(options));
|
|
2321
|
+
this.options = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, defOpts), this.options), transformOptions(options));
|
|
2290
2322
|
|
|
2291
2323
|
if (options.keySeparator !== undefined) {
|
|
2292
2324
|
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
@@ -2613,7 +2645,7 @@
|
|
|
2613
2645
|
|
|
2614
2646
|
options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
2615
2647
|
} else {
|
|
2616
|
-
options = _objectSpread({}, opts);
|
|
2648
|
+
options = _objectSpread$6({}, opts);
|
|
2617
2649
|
}
|
|
2618
2650
|
|
|
2619
2651
|
options.lng = options.lng || fixedT.lng;
|
|
@@ -2743,13 +2775,6 @@
|
|
|
2743
2775
|
var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];
|
|
2744
2776
|
return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
2745
2777
|
}
|
|
2746
|
-
}, {
|
|
2747
|
-
key: "createInstance",
|
|
2748
|
-
value: function createInstance() {
|
|
2749
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2750
|
-
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2751
|
-
return new I18n(options, callback);
|
|
2752
|
-
}
|
|
2753
2778
|
}, {
|
|
2754
2779
|
key: "cloneInstance",
|
|
2755
2780
|
value: function cloneInstance() {
|
|
@@ -2758,7 +2783,7 @@
|
|
|
2758
2783
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2759
2784
|
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
2760
2785
|
|
|
2761
|
-
var mergedOptions = _objectSpread({}, this.options, options, {
|
|
2786
|
+
var mergedOptions = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, this.options), options), {
|
|
2762
2787
|
isClone: true
|
|
2763
2788
|
});
|
|
2764
2789
|
|
|
@@ -2767,7 +2792,7 @@
|
|
|
2767
2792
|
membersToCopy.forEach(function (m) {
|
|
2768
2793
|
clone[m] = _this8[m];
|
|
2769
2794
|
});
|
|
2770
|
-
clone.services = _objectSpread({}, this.services);
|
|
2795
|
+
clone.services = _objectSpread$6({}, this.services);
|
|
2771
2796
|
clone.services.utils = {
|
|
2772
2797
|
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
2773
2798
|
};
|
|
@@ -2802,8 +2827,15 @@
|
|
|
2802
2827
|
return I18n;
|
|
2803
2828
|
}(EventEmitter);
|
|
2804
2829
|
|
|
2805
|
-
|
|
2830
|
+
_defineProperty(I18n, "createInstance", function () {
|
|
2831
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2832
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2833
|
+
return new I18n(options, callback);
|
|
2834
|
+
});
|
|
2835
|
+
|
|
2836
|
+
var instance = I18n.createInstance();
|
|
2837
|
+
instance.createInstance = I18n.createInstance;
|
|
2806
2838
|
|
|
2807
|
-
return
|
|
2839
|
+
return instance;
|
|
2808
2840
|
|
|
2809
2841
|
})));
|