locizify 9.0.7 → 9.0.9
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/CHANGELOG.md +8 -0
- package/dist/umd/locizify.js +113 -111
- package/dist/umd/locizify.min.js +2 -2
- package/locizify.js +113 -111
- package/locizify.min.js +2 -2
- package/package.json +2 -2
package/dist/umd/locizify.js
CHANGED
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
};
|
|
176
176
|
var makeString = object => {
|
|
177
177
|
if (object == null) return '';
|
|
178
|
-
return
|
|
178
|
+
return String(object);
|
|
179
179
|
};
|
|
180
180
|
var copy = (a, s, t) => {
|
|
181
181
|
a.forEach(m => {
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
});
|
|
184
184
|
};
|
|
185
185
|
var lastOfPathSeparatorRegExp = /###/g;
|
|
186
|
-
var cleanKey = key => key && key.
|
|
186
|
+
var cleanKey = key => key && key.includes('###') ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
|
|
187
187
|
var canNotTraverseDeeper = object => !object || isString(object);
|
|
188
188
|
var getLastOfPath = (object, path, Empty) => {
|
|
189
189
|
var stack = !isString(path) ? path : path.split('.');
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
|
|
309
309
|
nsSeparator = nsSeparator || '';
|
|
310
310
|
keySeparator = keySeparator || '';
|
|
311
|
-
var possibleChars = chars.filter(c => nsSeparator.
|
|
311
|
+
var possibleChars = chars.filter(c => !nsSeparator.includes(c) && !keySeparator.includes(c));
|
|
312
312
|
if (possibleChars.length === 0) return true;
|
|
313
313
|
var r = looksLikeObjectPathRegExpCache.getRegExp("(".concat(possibleChars.map(c => c === '?' ? '\\?' : c).join('|'), ")"));
|
|
314
314
|
var matched = !r.test(key);
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
nextPath += tokens[j];
|
|
343
343
|
next = current[nextPath];
|
|
344
344
|
if (next !== undefined) {
|
|
345
|
-
if (['string', 'number', 'boolean'].
|
|
345
|
+
if (['string', 'number', 'boolean'].includes(typeof next) && j < tokens.length - 1) {
|
|
346
346
|
continue;
|
|
347
347
|
}
|
|
348
348
|
i += j - i + 1;
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
}
|
|
354
354
|
return current;
|
|
355
355
|
};
|
|
356
|
-
var getCleanedCode = code => code === null || code === void 0 ? void 0 : code.replace(
|
|
356
|
+
var getCleanedCode = code => code === null || code === void 0 ? void 0 : code.replace(/_/g, '-');
|
|
357
357
|
var consoleLogger = {
|
|
358
358
|
type: 'logger',
|
|
359
359
|
log(args) {
|
|
@@ -443,6 +443,15 @@
|
|
|
443
443
|
}
|
|
444
444
|
this.observers[event].delete(listener);
|
|
445
445
|
}
|
|
446
|
+
once(event, listener) {
|
|
447
|
+
var _this = this;
|
|
448
|
+
var _wrapper = function wrapper() {
|
|
449
|
+
listener(...arguments);
|
|
450
|
+
_this.off(event, _wrapper);
|
|
451
|
+
};
|
|
452
|
+
this.on(event, _wrapper);
|
|
453
|
+
return this;
|
|
454
|
+
}
|
|
446
455
|
emit(event) {
|
|
447
456
|
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
|
448
457
|
args[_key5 - 1] = arguments[_key5];
|
|
@@ -461,7 +470,7 @@
|
|
|
461
470
|
_cloned.forEach(_ref2 => {
|
|
462
471
|
var [observer, numTimesAdded] = _ref2;
|
|
463
472
|
for (var i = 0; i < numTimesAdded; i++) {
|
|
464
|
-
observer
|
|
473
|
+
observer(event, ...args);
|
|
465
474
|
}
|
|
466
475
|
});
|
|
467
476
|
}
|
|
@@ -484,7 +493,7 @@
|
|
|
484
493
|
}
|
|
485
494
|
}
|
|
486
495
|
addNamespaces(ns) {
|
|
487
|
-
if (this.options.ns.
|
|
496
|
+
if (!this.options.ns.includes(ns)) {
|
|
488
497
|
this.options.ns.push(ns);
|
|
489
498
|
}
|
|
490
499
|
}
|
|
@@ -500,7 +509,7 @@
|
|
|
500
509
|
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
501
510
|
var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
502
511
|
var path;
|
|
503
|
-
if (lng.
|
|
512
|
+
if (lng.includes('.')) {
|
|
504
513
|
path = lng.split('.');
|
|
505
514
|
} else {
|
|
506
515
|
path = [lng, ns];
|
|
@@ -515,7 +524,7 @@
|
|
|
515
524
|
}
|
|
516
525
|
}
|
|
517
526
|
var result = getPath(this.data, path);
|
|
518
|
-
if (!result && !ns && !key && lng.
|
|
527
|
+
if (!result && !ns && !key && lng.includes('.')) {
|
|
519
528
|
lng = path[0];
|
|
520
529
|
ns = path[1];
|
|
521
530
|
key = path.slice(2).join('.');
|
|
@@ -530,7 +539,7 @@
|
|
|
530
539
|
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
531
540
|
var path = [lng, ns];
|
|
532
541
|
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
533
|
-
if (lng.
|
|
542
|
+
if (lng.includes('.')) {
|
|
534
543
|
path = lng.split('.');
|
|
535
544
|
value = ns;
|
|
536
545
|
ns = path[1];
|
|
@@ -556,7 +565,7 @@
|
|
|
556
565
|
skipCopy: false
|
|
557
566
|
};
|
|
558
567
|
var path = [lng, ns];
|
|
559
|
-
if (lng.
|
|
568
|
+
if (lng.includes('.')) {
|
|
560
569
|
path = lng.split('.');
|
|
561
570
|
deep = resources;
|
|
562
571
|
resources = ns;
|
|
@@ -628,13 +637,21 @@
|
|
|
628
637
|
return Proxy.revocable(Object.create(null), handler).proxy;
|
|
629
638
|
}
|
|
630
639
|
function keysFromSelector(selector, opts) {
|
|
631
|
-
var _opts$keySeparator;
|
|
640
|
+
var _opts$keySeparator, _opts$nsSeparator;
|
|
632
641
|
var {
|
|
633
642
|
[PATH_KEY]: path
|
|
634
643
|
} = selector(createProxy());
|
|
635
|
-
|
|
644
|
+
var keySeparator = (_opts$keySeparator = opts === null || opts === void 0 ? void 0 : opts.keySeparator) !== null && _opts$keySeparator !== void 0 ? _opts$keySeparator : '.';
|
|
645
|
+
var nsSeparator = (_opts$nsSeparator = opts === null || opts === void 0 ? void 0 : opts.nsSeparator) !== null && _opts$nsSeparator !== void 0 ? _opts$nsSeparator : ':';
|
|
646
|
+
if (path.length > 1 && nsSeparator) {
|
|
647
|
+
var ns = opts === null || opts === void 0 ? void 0 : opts.ns;
|
|
648
|
+
var nsArray = Array.isArray(ns) ? ns : null;
|
|
649
|
+
if (nsArray && nsArray.length > 1 && nsArray.slice(1).includes(path[0])) {
|
|
650
|
+
return "".concat(path[0]).concat(nsSeparator).concat(path.slice(1).join(keySeparator));
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return path.join(keySeparator);
|
|
636
654
|
}
|
|
637
|
-
var checkedLoadedFor = {};
|
|
638
655
|
var shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
|
|
639
656
|
class Translator extends EventEmitter {
|
|
640
657
|
constructor(services) {
|
|
@@ -646,6 +663,7 @@
|
|
|
646
663
|
this.options.keySeparator = '.';
|
|
647
664
|
}
|
|
648
665
|
this.logger = baseLogger.create('translator');
|
|
666
|
+
this.checkedLoadedFor = {};
|
|
649
667
|
}
|
|
650
668
|
changeLanguage(lng) {
|
|
651
669
|
if (lng) this.language = lng;
|
|
@@ -669,7 +687,7 @@
|
|
|
669
687
|
if (nsSeparator === undefined) nsSeparator = ':';
|
|
670
688
|
var keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
|
|
671
689
|
var namespaces = opt.ns || this.options.defaultNS || [];
|
|
672
|
-
var wouldCheckForNsInKey = nsSeparator && key.
|
|
690
|
+
var wouldCheckForNsInKey = nsSeparator && key.includes(nsSeparator);
|
|
673
691
|
var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
674
692
|
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
675
693
|
var m = key.match(this.interpolator.nestingRegexp);
|
|
@@ -680,7 +698,7 @@
|
|
|
680
698
|
};
|
|
681
699
|
}
|
|
682
700
|
var parts = key.split(nsSeparator);
|
|
683
|
-
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.
|
|
701
|
+
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.includes(parts[0])) namespaces = parts.shift();
|
|
684
702
|
key = parts.join(keySeparator);
|
|
685
703
|
}
|
|
686
704
|
return {
|
|
@@ -698,6 +716,7 @@
|
|
|
698
716
|
if (keys == null) return '';
|
|
699
717
|
if (typeof keys === 'function') keys = keysFromSelector(keys, _objectSpread2(_objectSpread2({}, this.options), opt));
|
|
700
718
|
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
719
|
+
keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, _objectSpread2(_objectSpread2({}, this.options), opt)) : String(k));
|
|
701
720
|
var returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
|
|
702
721
|
var keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
|
|
703
722
|
var {
|
|
@@ -756,7 +775,7 @@
|
|
|
756
775
|
}
|
|
757
776
|
var handleAsObject = shouldHandleAsObject(resForObjHndl);
|
|
758
777
|
var resType = Object.prototype.toString.apply(resForObjHndl);
|
|
759
|
-
if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.
|
|
778
|
+
if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
|
|
760
779
|
if (!opt.returnObjects && !this.options.returnObjects) {
|
|
761
780
|
if (!this.options.returnedObjectHandler) {
|
|
762
781
|
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
@@ -846,7 +865,7 @@
|
|
|
846
865
|
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
847
866
|
lngs.forEach(language => {
|
|
848
867
|
var suffixes = this.pluralResolver.getSuffixes(language, opt);
|
|
849
|
-
if (needsZeroSuffixLookup && opt["defaultValue".concat(this.options.pluralSeparator, "zero")] && suffixes.
|
|
868
|
+
if (needsZeroSuffixLookup && opt["defaultValue".concat(this.options.pluralSeparator, "zero")] && !suffixes.includes("".concat(this.options.pluralSeparator, "zero"))) {
|
|
850
869
|
suffixes.push("".concat(this.options.pluralSeparator, "zero"));
|
|
851
870
|
}
|
|
852
871
|
suffixes.forEach(suffix => {
|
|
@@ -875,7 +894,7 @@
|
|
|
875
894
|
}
|
|
876
895
|
extendTranslation(res, key, opt, resolved, lastKey) {
|
|
877
896
|
var _this$i18nFormat,
|
|
878
|
-
|
|
897
|
+
_this2 = this;
|
|
879
898
|
if ((_this$i18nFormat = this.i18nFormat) !== null && _this$i18nFormat !== void 0 && _this$i18nFormat.parse) {
|
|
880
899
|
res = this.i18nFormat.parse(res, _objectSpread2(_objectSpread2({}, this.options.interpolation.defaultVariables), opt), opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
881
900
|
resolved
|
|
@@ -905,10 +924,10 @@
|
|
|
905
924
|
args[_key6] = arguments[_key6];
|
|
906
925
|
}
|
|
907
926
|
if ((lastKey === null || lastKey === void 0 ? void 0 : lastKey[0]) === args[0] && !opt.context) {
|
|
908
|
-
|
|
927
|
+
_this2.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
|
|
909
928
|
return null;
|
|
910
929
|
}
|
|
911
|
-
return
|
|
930
|
+
return _this2.translate(...args, key);
|
|
912
931
|
}, opt);
|
|
913
932
|
if (opt.interpolation) this.interpolator.reset();
|
|
914
933
|
}
|
|
@@ -931,6 +950,7 @@
|
|
|
931
950
|
var usedLng;
|
|
932
951
|
var usedNS;
|
|
933
952
|
if (isString(keys)) keys = [keys];
|
|
953
|
+
if (Array.isArray(keys)) keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, _objectSpread2(_objectSpread2({}, this.options), opt)) : k);
|
|
934
954
|
keys.forEach(k => {
|
|
935
955
|
if (this.isValidLookup(found)) return;
|
|
936
956
|
var extracted = this.extractFromKey(k, opt);
|
|
@@ -946,8 +966,8 @@
|
|
|
946
966
|
var _this$utils, _this$utils2;
|
|
947
967
|
if (this.isValidLookup(found)) return;
|
|
948
968
|
usedNS = ns;
|
|
949
|
-
if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && (_this$utils = this.utils) !== null && _this$utils !== void 0 && _this$utils.hasLoadedNamespace && !((_this$utils2 = this.utils) !== null && _this$utils2 !== void 0 && _this$utils2.hasLoadedNamespace(usedNS))) {
|
|
950
|
-
checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
|
|
969
|
+
if (!this.checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && (_this$utils = this.utils) !== null && _this$utils !== void 0 && _this$utils.hasLoadedNamespace && !((_this$utils2 = this.utils) !== null && _this$utils2 !== void 0 && _this$utils2.hasLoadedNamespace(usedNS))) {
|
|
970
|
+
this.checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
|
|
951
971
|
this.logger.warn("key \"".concat(usedKey, "\" for languages \"").concat(codes.join(', '), "\" won't get resolved as namespace \"").concat(usedNS, "\" 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!!!');
|
|
952
972
|
}
|
|
953
973
|
codes.forEach(code => {
|
|
@@ -963,7 +983,7 @@
|
|
|
963
983
|
var zeroSuffix = "".concat(this.options.pluralSeparator, "zero");
|
|
964
984
|
var ordinalPrefix = "".concat(this.options.pluralSeparator, "ordinal").concat(this.options.pluralSeparator);
|
|
965
985
|
if (needsPluralHandling) {
|
|
966
|
-
if (opt.ordinal && pluralSuffix.
|
|
986
|
+
if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
|
|
967
987
|
finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
968
988
|
}
|
|
969
989
|
finalKeys.push(key + pluralSuffix);
|
|
@@ -975,7 +995,7 @@
|
|
|
975
995
|
var contextKey = "".concat(key).concat(this.options.contextSeparator || '_').concat(opt.context);
|
|
976
996
|
finalKeys.push(contextKey);
|
|
977
997
|
if (needsPluralHandling) {
|
|
978
|
-
if (opt.ordinal && pluralSuffix.
|
|
998
|
+
if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
|
|
979
999
|
finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
|
|
980
1000
|
}
|
|
981
1001
|
finalKeys.push(contextKey + pluralSuffix);
|
|
@@ -1034,7 +1054,7 @@
|
|
|
1034
1054
|
static hasDefaultValue(options) {
|
|
1035
1055
|
var prefix = 'defaultValue';
|
|
1036
1056
|
for (var option in options) {
|
|
1037
|
-
if (Object.prototype.hasOwnProperty.call(options, option) &&
|
|
1057
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && option.startsWith(prefix) && undefined !== options[option]) {
|
|
1038
1058
|
return true;
|
|
1039
1059
|
}
|
|
1040
1060
|
}
|
|
@@ -1049,7 +1069,7 @@
|
|
|
1049
1069
|
}
|
|
1050
1070
|
getScriptPartFromCode(code) {
|
|
1051
1071
|
code = getCleanedCode(code);
|
|
1052
|
-
if (!code || code.
|
|
1072
|
+
if (!code || !code.includes('-')) return null;
|
|
1053
1073
|
var p = code.split('-');
|
|
1054
1074
|
if (p.length === 2) return null;
|
|
1055
1075
|
p.pop();
|
|
@@ -1058,12 +1078,12 @@
|
|
|
1058
1078
|
}
|
|
1059
1079
|
getLanguagePartFromCode(code) {
|
|
1060
1080
|
code = getCleanedCode(code);
|
|
1061
|
-
if (!code || code.
|
|
1081
|
+
if (!code || !code.includes('-')) return code;
|
|
1062
1082
|
var p = code.split('-');
|
|
1063
1083
|
return this.formatLanguageCode(p[0]);
|
|
1064
1084
|
}
|
|
1065
1085
|
formatLanguageCode(code) {
|
|
1066
|
-
if (isString(code) && code.
|
|
1086
|
+
if (isString(code) && code.includes('-')) {
|
|
1067
1087
|
var formattedCode;
|
|
1068
1088
|
try {
|
|
1069
1089
|
formattedCode = Intl.getCanonicalLocales(code)[0];
|
|
@@ -1083,7 +1103,7 @@
|
|
|
1083
1103
|
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
1084
1104
|
code = this.getLanguagePartFromCode(code);
|
|
1085
1105
|
}
|
|
1086
|
-
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.
|
|
1106
|
+
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(code);
|
|
1087
1107
|
}
|
|
1088
1108
|
getBestMatchFromCodes(codes) {
|
|
1089
1109
|
if (!codes) return null;
|
|
@@ -1101,10 +1121,11 @@
|
|
|
1101
1121
|
var lngOnly = this.getLanguagePartFromCode(code);
|
|
1102
1122
|
if (this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
1103
1123
|
found = this.options.supportedLngs.find(supportedLng => {
|
|
1104
|
-
if (supportedLng === lngOnly) return
|
|
1105
|
-
if (supportedLng.
|
|
1106
|
-
if (supportedLng.
|
|
1107
|
-
if (supportedLng.
|
|
1124
|
+
if (supportedLng === lngOnly) return true;
|
|
1125
|
+
if (!supportedLng.includes('-') && !lngOnly.includes('-')) return false;
|
|
1126
|
+
if (supportedLng.includes('-') && !lngOnly.includes('-') && supportedLng.slice(0, supportedLng.indexOf('-')) === lngOnly) return true;
|
|
1127
|
+
if (supportedLng.startsWith(lngOnly) && lngOnly.length > 1) return true;
|
|
1128
|
+
return false;
|
|
1108
1129
|
});
|
|
1109
1130
|
});
|
|
1110
1131
|
}
|
|
@@ -1135,7 +1156,7 @@
|
|
|
1135
1156
|
this.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
|
|
1136
1157
|
}
|
|
1137
1158
|
};
|
|
1138
|
-
if (isString(code) && (code.
|
|
1159
|
+
if (isString(code) && (code.includes('-') || code.includes('_'))) {
|
|
1139
1160
|
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
1140
1161
|
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
1141
1162
|
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
@@ -1143,7 +1164,7 @@
|
|
|
1143
1164
|
addCode(this.formatLanguageCode(code));
|
|
1144
1165
|
}
|
|
1145
1166
|
fallbackCodes.forEach(fc => {
|
|
1146
|
-
if (codes.
|
|
1167
|
+
if (!codes.includes(fc)) addCode(this.formatLanguageCode(fc));
|
|
1147
1168
|
});
|
|
1148
1169
|
return codes;
|
|
1149
1170
|
}
|
|
@@ -1310,7 +1331,7 @@
|
|
|
1310
1331
|
var replaces;
|
|
1311
1332
|
var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
|
|
1312
1333
|
var handleFormat = key => {
|
|
1313
|
-
if (key.
|
|
1334
|
+
if (!key.includes(this.formatSeparator)) {
|
|
1314
1335
|
var path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1315
1336
|
return this.alwaysFormat ? this.format(path, undefined, lng, _objectSpread2(_objectSpread2(_objectSpread2({}, options), data), {}, {
|
|
1316
1337
|
interpolationkey: key
|
|
@@ -1378,7 +1399,7 @@
|
|
|
1378
1399
|
var handleHasOptions = (key, inheritedOptions) => {
|
|
1379
1400
|
var _matchedSingleQuotes$, _matchedDoubleQuotes$;
|
|
1380
1401
|
var sep = this.nestingOptionsSeparator;
|
|
1381
|
-
if (key.
|
|
1402
|
+
if (!key.includes(sep)) return key;
|
|
1382
1403
|
var c = key.split(new RegExp("".concat(regexEscape(sep), "[ ]*{")));
|
|
1383
1404
|
var optionsString = "{".concat(c[1]);
|
|
1384
1405
|
key = c[0];
|
|
@@ -1395,7 +1416,7 @@
|
|
|
1395
1416
|
this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
|
|
1396
1417
|
return "".concat(key).concat(sep).concat(optionsString);
|
|
1397
1418
|
}
|
|
1398
|
-
if (clonedOptions.defaultValue && clonedOptions.defaultValue.
|
|
1419
|
+
if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
|
|
1399
1420
|
return key;
|
|
1400
1421
|
};
|
|
1401
1422
|
while (match = this.nestingRegexp.exec(str)) {
|
|
@@ -1430,13 +1451,13 @@
|
|
|
1430
1451
|
var parseFormatStr = formatStr => {
|
|
1431
1452
|
var formatName = formatStr.toLowerCase().trim();
|
|
1432
1453
|
var formatOptions = {};
|
|
1433
|
-
if (formatStr.
|
|
1454
|
+
if (formatStr.includes('(')) {
|
|
1434
1455
|
var p = formatStr.split('(');
|
|
1435
1456
|
formatName = p[0].toLowerCase().trim();
|
|
1436
|
-
var optStr = p[1].
|
|
1437
|
-
if (formatName === 'currency' && optStr.
|
|
1457
|
+
var optStr = p[1].slice(0, -1);
|
|
1458
|
+
if (formatName === 'currency' && !optStr.includes(':')) {
|
|
1438
1459
|
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
1439
|
-
} else if (formatName === 'relativetime' && optStr.
|
|
1460
|
+
} else if (formatName === 'relativetime' && !optStr.includes(':')) {
|
|
1440
1461
|
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
1441
1462
|
} else {
|
|
1442
1463
|
var opts = optStr.split(';');
|
|
@@ -1523,9 +1544,11 @@
|
|
|
1523
1544
|
}
|
|
1524
1545
|
format(value, format, lng) {
|
|
1525
1546
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1547
|
+
if (!format) return value;
|
|
1548
|
+
if (value == null) return value;
|
|
1526
1549
|
var formats = format.split(this.formatSeparator);
|
|
1527
|
-
if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].
|
|
1528
|
-
var lastIndex = formats.findIndex(f => f.
|
|
1550
|
+
if (formats.length > 1 && formats[0].indexOf('(') > 1 && !formats[0].includes(')') && formats.find(f => f.includes(')'))) {
|
|
1551
|
+
var lastIndex = formats.findIndex(f => f.includes(')'));
|
|
1529
1552
|
formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
|
|
1530
1553
|
}
|
|
1531
1554
|
var result = formats.reduce((mem, f) => {
|
|
@@ -1680,7 +1703,7 @@
|
|
|
1680
1703
|
}
|
|
1681
1704
|
if (err && data && tried < this.maxRetries) {
|
|
1682
1705
|
setTimeout(() => {
|
|
1683
|
-
this.read
|
|
1706
|
+
this.read(lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
1684
1707
|
}, wait);
|
|
1685
1708
|
return;
|
|
1686
1709
|
}
|
|
@@ -1788,7 +1811,6 @@
|
|
|
1788
1811
|
nonExplicitSupportedLngs: false,
|
|
1789
1812
|
load: 'all',
|
|
1790
1813
|
preload: false,
|
|
1791
|
-
simplifyPluralSuffix: true,
|
|
1792
1814
|
keySeparator: '.',
|
|
1793
1815
|
nsSeparator: ':',
|
|
1794
1816
|
pluralSeparator: '_',
|
|
@@ -1825,7 +1847,6 @@
|
|
|
1825
1847
|
},
|
|
1826
1848
|
interpolation: {
|
|
1827
1849
|
escapeValue: true,
|
|
1828
|
-
format: value => value,
|
|
1829
1850
|
prefix: '{{',
|
|
1830
1851
|
suffix: '}}',
|
|
1831
1852
|
formatSeparator: ',',
|
|
@@ -1839,14 +1860,12 @@
|
|
|
1839
1860
|
cacheInBuiltFormats: true
|
|
1840
1861
|
});
|
|
1841
1862
|
var transformOptions = options => {
|
|
1842
|
-
var _options$supportedLng, _options$supportedLng2;
|
|
1843
1863
|
if (isString(options.ns)) options.ns = [options.ns];
|
|
1844
1864
|
if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
|
|
1845
1865
|
if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
|
|
1846
|
-
if (
|
|
1866
|
+
if (options.supportedLngs && !options.supportedLngs.includes('cimode')) {
|
|
1847
1867
|
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
1848
1868
|
}
|
|
1849
|
-
if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;
|
|
1850
1869
|
return options;
|
|
1851
1870
|
};
|
|
1852
1871
|
var noop = () => {};
|
|
@@ -1858,23 +1877,6 @@
|
|
|
1858
1877
|
}
|
|
1859
1878
|
});
|
|
1860
1879
|
};
|
|
1861
|
-
var SUPPORT_NOTICE_KEY = '__i18next_supportNoticeShown';
|
|
1862
|
-
var getSupportNoticeShown = () => typeof globalThis !== 'undefined' && !!globalThis[SUPPORT_NOTICE_KEY];
|
|
1863
|
-
var setSupportNoticeShown = () => {
|
|
1864
|
-
if (typeof globalThis !== 'undefined') globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
1865
|
-
};
|
|
1866
|
-
var usesLocize = inst => {
|
|
1867
|
-
var _inst$modules, _inst$modules2, _inst$options;
|
|
1868
|
-
if ((inst === null || inst === void 0 || (_inst$modules = inst.modules) === null || _inst$modules === void 0 || (_inst$modules = _inst$modules.backend) === null || _inst$modules === void 0 || (_inst$modules = _inst$modules.name) === null || _inst$modules === void 0 ? void 0 : _inst$modules.indexOf('Locize')) > 0) return true;
|
|
1869
|
-
if ((inst === null || inst === void 0 || (_inst$modules2 = inst.modules) === null || _inst$modules2 === void 0 || (_inst$modules2 = _inst$modules2.backend) === null || _inst$modules2 === void 0 || (_inst$modules2 = _inst$modules2.constructor) === null || _inst$modules2 === void 0 || (_inst$modules2 = _inst$modules2.name) === null || _inst$modules2 === void 0 ? void 0 : _inst$modules2.indexOf('Locize')) > 0) return true;
|
|
1870
|
-
if (inst !== null && inst !== void 0 && (_inst$options = inst.options) !== null && _inst$options !== void 0 && (_inst$options = _inst$options.backend) !== null && _inst$options !== void 0 && _inst$options.backends) {
|
|
1871
|
-
if (inst.options.backend.backends.some(b => {
|
|
1872
|
-
var _b$name, _b$constructor;
|
|
1873
|
-
return (b === null || b === void 0 || (_b$name = b.name) === null || _b$name === void 0 ? void 0 : _b$name.indexOf('Locize')) > 0 || (b === null || b === void 0 || (_b$constructor = b.constructor) === null || _b$constructor === void 0 || (_b$constructor = _b$constructor.name) === null || _b$constructor === void 0 ? void 0 : _b$constructor.indexOf('Locize')) > 0;
|
|
1874
|
-
})) return true;
|
|
1875
|
-
}
|
|
1876
|
-
return false;
|
|
1877
|
-
};
|
|
1878
1880
|
class I18n extends EventEmitter {
|
|
1879
1881
|
constructor() {
|
|
1880
1882
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -1898,7 +1900,7 @@
|
|
|
1898
1900
|
}
|
|
1899
1901
|
}
|
|
1900
1902
|
init() {
|
|
1901
|
-
var
|
|
1903
|
+
var _this3 = this;
|
|
1902
1904
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1903
1905
|
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
1904
1906
|
this.isInitializing = true;
|
|
@@ -1909,7 +1911,7 @@
|
|
|
1909
1911
|
if (options.defaultNS == null && options.ns) {
|
|
1910
1912
|
if (isString(options.ns)) {
|
|
1911
1913
|
options.defaultNS = options.ns;
|
|
1912
|
-
} else if (options.ns.
|
|
1914
|
+
} else if (!options.ns.includes('translation')) {
|
|
1913
1915
|
options.defaultNS = options.ns[0];
|
|
1914
1916
|
}
|
|
1915
1917
|
}
|
|
@@ -1925,10 +1927,6 @@
|
|
|
1925
1927
|
if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
|
|
1926
1928
|
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
1927
1929
|
}
|
|
1928
|
-
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
1929
|
-
if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙');
|
|
1930
|
-
setSupportNoticeShown();
|
|
1931
|
-
}
|
|
1932
1930
|
var createClassOnDemand = ClassOrObject => {
|
|
1933
1931
|
if (!ClassOrObject) return null;
|
|
1934
1932
|
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
@@ -1953,14 +1951,9 @@
|
|
|
1953
1951
|
s.resourceStore = this.store;
|
|
1954
1952
|
s.languageUtils = lu;
|
|
1955
1953
|
s.pluralResolver = new PluralResolver(lu, {
|
|
1956
|
-
prepend: this.options.pluralSeparator
|
|
1957
|
-
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1954
|
+
prepend: this.options.pluralSeparator
|
|
1958
1955
|
});
|
|
1959
|
-
|
|
1960
|
-
if (usingLegacyFormatFunction) {
|
|
1961
|
-
this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting");
|
|
1962
|
-
}
|
|
1963
|
-
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
1956
|
+
if (formatter) {
|
|
1964
1957
|
s.formatter = createClassOnDemand(formatter);
|
|
1965
1958
|
if (s.formatter.init) s.formatter.init(s, this.options);
|
|
1966
1959
|
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
@@ -1974,7 +1967,7 @@
|
|
|
1974
1967
|
for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
1975
1968
|
args[_key7 - 1] = arguments[_key7];
|
|
1976
1969
|
}
|
|
1977
|
-
|
|
1970
|
+
_this3.emit(event, ...args);
|
|
1978
1971
|
});
|
|
1979
1972
|
if (this.modules.languageDetector) {
|
|
1980
1973
|
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
@@ -1989,7 +1982,7 @@
|
|
|
1989
1982
|
for (var _len8 = arguments.length, args = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
1990
1983
|
args[_key8 - 1] = arguments[_key8];
|
|
1991
1984
|
}
|
|
1992
|
-
|
|
1985
|
+
_this3.emit(event, ...args);
|
|
1993
1986
|
});
|
|
1994
1987
|
this.modules.external.forEach(m => {
|
|
1995
1988
|
if (m.init) m.init(this);
|
|
@@ -2007,14 +2000,14 @@
|
|
|
2007
2000
|
var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
2008
2001
|
storeApi.forEach(fcName => {
|
|
2009
2002
|
this[fcName] = function () {
|
|
2010
|
-
return
|
|
2003
|
+
return _this3.store[fcName](...arguments);
|
|
2011
2004
|
};
|
|
2012
2005
|
});
|
|
2013
2006
|
var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
2014
2007
|
storeApiChained.forEach(fcName => {
|
|
2015
2008
|
this[fcName] = function () {
|
|
2016
|
-
|
|
2017
|
-
return
|
|
2009
|
+
_this3.store[fcName](...arguments);
|
|
2010
|
+
return _this3;
|
|
2018
2011
|
};
|
|
2019
2012
|
});
|
|
2020
2013
|
var deferred = defer();
|
|
@@ -2053,7 +2046,7 @@
|
|
|
2053
2046
|
var lngs = this.services.languageUtils.toResolveHierarchy(lng);
|
|
2054
2047
|
lngs.forEach(l => {
|
|
2055
2048
|
if (l === 'cimode') return;
|
|
2056
|
-
if (toLoad.
|
|
2049
|
+
if (!toLoad.includes(l)) toLoad.push(l);
|
|
2057
2050
|
});
|
|
2058
2051
|
};
|
|
2059
2052
|
if (!usedLng) {
|
|
@@ -2118,22 +2111,22 @@
|
|
|
2118
2111
|
}
|
|
2119
2112
|
setResolvedLanguage(l) {
|
|
2120
2113
|
if (!l || !this.languages) return;
|
|
2121
|
-
if (['cimode', 'dev'].
|
|
2114
|
+
if (['cimode', 'dev'].includes(l)) return;
|
|
2122
2115
|
for (var li = 0; li < this.languages.length; li++) {
|
|
2123
2116
|
var lngInLngs = this.languages[li];
|
|
2124
|
-
if (['cimode', 'dev'].
|
|
2117
|
+
if (['cimode', 'dev'].includes(lngInLngs)) continue;
|
|
2125
2118
|
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
2126
2119
|
this.resolvedLanguage = lngInLngs;
|
|
2127
2120
|
break;
|
|
2128
2121
|
}
|
|
2129
2122
|
}
|
|
2130
|
-
if (!this.resolvedLanguage && this.languages.
|
|
2123
|
+
if (!this.resolvedLanguage && !this.languages.includes(l) && this.store.hasLanguageSomeTranslations(l)) {
|
|
2131
2124
|
this.resolvedLanguage = l;
|
|
2132
2125
|
this.languages.unshift(l);
|
|
2133
2126
|
}
|
|
2134
2127
|
}
|
|
2135
2128
|
changeLanguage(lng, callback) {
|
|
2136
|
-
var
|
|
2129
|
+
var _this4 = this;
|
|
2137
2130
|
this.isLanguageChangingTo = lng;
|
|
2138
2131
|
var deferred = defer();
|
|
2139
2132
|
this.emit('languageChanging', lng);
|
|
@@ -2156,10 +2149,10 @@
|
|
|
2156
2149
|
this.isLanguageChangingTo = undefined;
|
|
2157
2150
|
}
|
|
2158
2151
|
deferred.resolve(function () {
|
|
2159
|
-
return
|
|
2152
|
+
return _this4.t(...arguments);
|
|
2160
2153
|
});
|
|
2161
2154
|
if (callback) callback(err, function () {
|
|
2162
|
-
return
|
|
2155
|
+
return _this4.t(...arguments);
|
|
2163
2156
|
});
|
|
2164
2157
|
};
|
|
2165
2158
|
var setLng = lngs => {
|
|
@@ -2192,14 +2185,14 @@
|
|
|
2192
2185
|
return deferred;
|
|
2193
2186
|
}
|
|
2194
2187
|
getFixedT(lng, ns, keyPrefix) {
|
|
2195
|
-
var
|
|
2188
|
+
var _this5 = this;
|
|
2196
2189
|
var _fixedT = function fixedT(key, opts) {
|
|
2197
2190
|
var o;
|
|
2198
2191
|
if (typeof opts !== 'object') {
|
|
2199
2192
|
for (var _len9 = arguments.length, rest = new Array(_len9 > 2 ? _len9 - 2 : 0), _key9 = 2; _key9 < _len9; _key9++) {
|
|
2200
2193
|
rest[_key9 - 2] = arguments[_key9];
|
|
2201
2194
|
}
|
|
2202
|
-
o =
|
|
2195
|
+
o = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
2203
2196
|
} else {
|
|
2204
2197
|
o = _objectSpread2({}, opts);
|
|
2205
2198
|
}
|
|
@@ -2207,18 +2200,20 @@
|
|
|
2207
2200
|
o.lngs = o.lngs || _fixedT.lngs;
|
|
2208
2201
|
o.ns = o.ns || _fixedT.ns;
|
|
2209
2202
|
if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || _fixedT.keyPrefix;
|
|
2210
|
-
var
|
|
2203
|
+
var selectorOpts = _objectSpread2(_objectSpread2({}, _this5.options), o);
|
|
2204
|
+
if (typeof o.keyPrefix === 'function') o.keyPrefix = keysFromSelector(o.keyPrefix, selectorOpts);
|
|
2205
|
+
var keySeparator = _this5.options.keySeparator || '.';
|
|
2211
2206
|
var resultKey;
|
|
2212
2207
|
if (o.keyPrefix && Array.isArray(key)) {
|
|
2213
2208
|
resultKey = key.map(k => {
|
|
2214
|
-
if (typeof k === 'function') k = keysFromSelector(k,
|
|
2209
|
+
if (typeof k === 'function') k = keysFromSelector(k, selectorOpts);
|
|
2215
2210
|
return "".concat(o.keyPrefix).concat(keySeparator).concat(k);
|
|
2216
2211
|
});
|
|
2217
2212
|
} else {
|
|
2218
|
-
if (typeof key === 'function') key = keysFromSelector(key,
|
|
2213
|
+
if (typeof key === 'function') key = keysFromSelector(key, selectorOpts);
|
|
2219
2214
|
resultKey = o.keyPrefix ? "".concat(o.keyPrefix).concat(keySeparator).concat(key) : key;
|
|
2220
2215
|
}
|
|
2221
|
-
return
|
|
2216
|
+
return _this5.t(resultKey, o);
|
|
2222
2217
|
};
|
|
2223
2218
|
if (isString(lng)) {
|
|
2224
2219
|
_fixedT.lng = lng;
|
|
@@ -2281,7 +2276,7 @@
|
|
|
2281
2276
|
}
|
|
2282
2277
|
if (isString(ns)) ns = [ns];
|
|
2283
2278
|
ns.forEach(n => {
|
|
2284
|
-
if (this.options.ns.
|
|
2279
|
+
if (!this.options.ns.includes(n)) this.options.ns.push(n);
|
|
2285
2280
|
});
|
|
2286
2281
|
this.loadResources(err => {
|
|
2287
2282
|
deferred.resolve();
|
|
@@ -2293,7 +2288,7 @@
|
|
|
2293
2288
|
var deferred = defer();
|
|
2294
2289
|
if (isString(lngs)) lngs = [lngs];
|
|
2295
2290
|
var preloaded = this.options.preload || [];
|
|
2296
|
-
var newLngs = lngs.filter(lng => preloaded.
|
|
2291
|
+
var newLngs = lngs.filter(lng => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
|
|
2297
2292
|
if (!newLngs.length) {
|
|
2298
2293
|
if (callback) callback();
|
|
2299
2294
|
return Promise.resolve();
|
|
@@ -2319,7 +2314,7 @@
|
|
|
2319
2314
|
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'];
|
|
2320
2315
|
var languageUtils = ((_this$services3 = this.services) === null || _this$services3 === void 0 ? void 0 : _this$services3.languageUtils) || new LanguageUtil(get());
|
|
2321
2316
|
if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
|
|
2322
|
-
return rtlLngs.
|
|
2317
|
+
return rtlLngs.includes(languageUtils.getLanguagePartFromCode(lng)) || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
2323
2318
|
}
|
|
2324
2319
|
static createInstance() {
|
|
2325
2320
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -2429,6 +2424,13 @@
|
|
|
2429
2424
|
}
|
|
2430
2425
|
return Promise.resolve(maybePromise);
|
|
2431
2426
|
}
|
|
2427
|
+
var interpolationRegexp = /\{\{(.+?)\}\}/g;
|
|
2428
|
+
function interpolate(str, data) {
|
|
2429
|
+
return str.replace(interpolationRegexp, function (match, key) {
|
|
2430
|
+
var value = data[key.trim()];
|
|
2431
|
+
return value != null ? value : match;
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2432
2434
|
|
|
2433
2435
|
function ownKeys$1(e, r) {
|
|
2434
2436
|
var t = Object.keys(e);
|
|
@@ -2777,7 +2779,7 @@
|
|
|
2777
2779
|
loadPath = makePromise(loadPath);
|
|
2778
2780
|
loadPath.then(function (resolvedLoadPath) {
|
|
2779
2781
|
if (!resolvedLoadPath) return callback(null, {});
|
|
2780
|
-
var url =
|
|
2782
|
+
var url = interpolate(resolvedLoadPath, {
|
|
2781
2783
|
lng: languages.join('+'),
|
|
2782
2784
|
ns: namespaces.join('+')
|
|
2783
2785
|
});
|
|
@@ -2833,7 +2835,7 @@
|
|
|
2833
2835
|
if (typeof _this4.options.addPath === 'function') {
|
|
2834
2836
|
addPath = _this4.options.addPath(lng, namespace);
|
|
2835
2837
|
}
|
|
2836
|
-
var url =
|
|
2838
|
+
var url = interpolate(addPath, {
|
|
2837
2839
|
lng: lng,
|
|
2838
2840
|
ns: namespace
|
|
2839
2841
|
});
|
|
@@ -7295,7 +7297,7 @@
|
|
|
7295
7297
|
if (object == null) return '';
|
|
7296
7298
|
return '' + object;
|
|
7297
7299
|
}
|
|
7298
|
-
function interpolate(str, data, lng) {
|
|
7300
|
+
function interpolate$1(str, data, lng) {
|
|
7299
7301
|
var match, value;
|
|
7300
7302
|
function regexSafe(val) {
|
|
7301
7303
|
return val.replace(/\$/g, '$$$$');
|
|
@@ -7791,7 +7793,7 @@
|
|
|
7791
7793
|
callback(new Error(isMissing));
|
|
7792
7794
|
return deferred;
|
|
7793
7795
|
}
|
|
7794
|
-
var url = interpolate(this.options.getLanguagesPath, {
|
|
7796
|
+
var url = interpolate$1(this.options.getLanguagesPath, {
|
|
7795
7797
|
projectId: this.options.projectId
|
|
7796
7798
|
});
|
|
7797
7799
|
if (!this.isProjectNotExisting && this.storage.isProjectNotExisting(this.options.projectId)) {
|
|
@@ -7811,7 +7813,7 @@
|
|
|
7811
7813
|
_this3.isProjectNotExistingErrorMessage = errMsg;
|
|
7812
7814
|
var cdnTypeAlt = _this3.options.cdnType === 'standard' ? 'pro' : 'standard';
|
|
7813
7815
|
var otherEndpointApiPaths = getApiPaths(cdnTypeAlt);
|
|
7814
|
-
var urlAlt = interpolate(otherEndpointApiPaths.getLanguagesPath, {
|
|
7816
|
+
var urlAlt = interpolate$1(otherEndpointApiPaths.getLanguagesPath, {
|
|
7815
7817
|
projectId: _this3.options.projectId
|
|
7816
7818
|
});
|
|
7817
7819
|
_this3.loadUrl({}, urlAlt, function (errAlt, retAlt, infoAlt) {
|
|
@@ -7946,7 +7948,7 @@
|
|
|
7946
7948
|
if (this.options.private) {
|
|
7947
7949
|
var isMissing = isMissingOption(this.options, ['projectId', 'version', 'apiKey']);
|
|
7948
7950
|
if (isMissing) return callback(new Error(isMissing), false);
|
|
7949
|
-
url = interpolate(this.options.privatePath, {
|
|
7951
|
+
url = interpolate$1(this.options.privatePath, {
|
|
7950
7952
|
lng: language,
|
|
7951
7953
|
ns: namespace,
|
|
7952
7954
|
projectId: this.options.projectId,
|
|
@@ -7958,7 +7960,7 @@
|
|
|
7958
7960
|
} else {
|
|
7959
7961
|
var _isMissing = isMissingOption(this.options, ['projectId', 'version']);
|
|
7960
7962
|
if (_isMissing) return callback(new Error(_isMissing), false);
|
|
7961
|
-
url = interpolate(this.options.loadPath, {
|
|
7963
|
+
url = interpolate$1(this.options.loadPath, {
|
|
7962
7964
|
lng: language,
|
|
7963
7965
|
ns: namespace,
|
|
7964
7966
|
projectId: this.options.projectId,
|
|
@@ -8123,13 +8125,13 @@
|
|
|
8123
8125
|
}, {
|
|
8124
8126
|
key: "writePage",
|
|
8125
8127
|
value: function writePage(lng, namespace, missings, callback) {
|
|
8126
|
-
var missingUrl = interpolate(this.options.addPath, {
|
|
8128
|
+
var missingUrl = interpolate$1(this.options.addPath, {
|
|
8127
8129
|
lng: lng,
|
|
8128
8130
|
ns: namespace,
|
|
8129
8131
|
projectId: this.options.projectId,
|
|
8130
8132
|
version: this.options.version
|
|
8131
8133
|
});
|
|
8132
|
-
var updatesUrl = interpolate(this.options.updatePath, {
|
|
8134
|
+
var updatesUrl = interpolate$1(this.options.updatePath, {
|
|
8133
8135
|
lng: lng,
|
|
8134
8136
|
ns: namespace,
|
|
8135
8137
|
projectId: this.options.projectId,
|