i18next 22.4.8 → 22.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -592,14 +592,24 @@ var Translator = function (_EventEmitter) {
592
592
  if (appendNamespaceToCIMode) {
593
593
  var nsSeparator = options.nsSeparator || this.options.nsSeparator;
594
594
  if (returnDetails) {
595
- resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
596
- return resolved;
595
+ return {
596
+ res: "".concat(namespace).concat(nsSeparator).concat(key),
597
+ usedKey: key,
598
+ exactUsedKey: key,
599
+ usedLng: lng,
600
+ usedNS: namespace
601
+ };
597
602
  }
598
603
  return "".concat(namespace).concat(nsSeparator).concat(key);
599
604
  }
600
605
  if (returnDetails) {
601
- resolved.res = key;
602
- return resolved;
606
+ return {
607
+ res: key,
608
+ usedKey: key,
609
+ exactUsedKey: key,
610
+ usedLng: lng,
611
+ usedNS: namespace
612
+ };
603
613
  }
604
614
  return key;
605
615
  }
@@ -1398,7 +1408,7 @@ var Interpolator = function () {
1398
1408
  if (typeof missingInterpolationHandler === 'function') {
1399
1409
  var temp = missingInterpolationHandler(str, match, options);
1400
1410
  value = typeof temp === 'string' ? temp : '';
1401
- } else if (options && options.hasOwnProperty(matchedVar)) {
1411
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1402
1412
  value = '';
1403
1413
  } else if (skipOnVariables) {
1404
1414
  value = match[0];
@@ -1547,34 +1557,34 @@ var Formatter = function () {
1547
1557
  this.logger = baseLogger.create('formatter');
1548
1558
  this.options = options;
1549
1559
  this.formats = {
1550
- number: createCachedFormatter(function (lng, options) {
1551
- var formatter = new Intl.NumberFormat(lng, options);
1560
+ number: createCachedFormatter(function (lng, opt) {
1561
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
1552
1562
  return function (val) {
1553
1563
  return formatter.format(val);
1554
1564
  };
1555
1565
  }),
1556
- currency: createCachedFormatter(function (lng, options) {
1557
- var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, options), {}, {
1566
+ currency: createCachedFormatter(function (lng, opt) {
1567
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
1558
1568
  style: 'currency'
1559
1569
  }));
1560
1570
  return function (val) {
1561
1571
  return formatter.format(val);
1562
1572
  };
1563
1573
  }),
1564
- datetime: createCachedFormatter(function (lng, options) {
1565
- var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, options));
1574
+ datetime: createCachedFormatter(function (lng, opt) {
1575
+ var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
1566
1576
  return function (val) {
1567
1577
  return formatter.format(val);
1568
1578
  };
1569
1579
  }),
1570
- relativetime: createCachedFormatter(function (lng, options) {
1571
- var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, options));
1580
+ relativetime: createCachedFormatter(function (lng, opt) {
1581
+ var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
1572
1582
  return function (val) {
1573
- return formatter.format(val, options.range || 'day');
1583
+ return formatter.format(val, opt.range || 'day');
1574
1584
  };
1575
1585
  }),
1576
- list: createCachedFormatter(function (lng, options) {
1577
- var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, options));
1586
+ list: createCachedFormatter(function (lng, opt) {
1587
+ var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
1578
1588
  return function (val) {
1579
1589
  return formatter.format(val);
1580
1590
  };
@@ -1603,8 +1613,9 @@ var Formatter = function () {
1603
1613
  }
1604
1614
  }, {
1605
1615
  key: "format",
1606
- value: function format(value, _format, lng, options) {
1616
+ value: function format(value, _format, lng) {
1607
1617
  var _this = this;
1618
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1608
1619
  var formats = _format.split(this.formatSeparator);
1609
1620
  var result = formats.reduce(function (mem, f) {
1610
1621
  var _parseFormatStr = parseFormatStr(f),
@@ -1733,8 +1744,8 @@ var Connector = function (_EventEmitter) {
1733
1744
  if (!loaded[l]) loaded[l] = {};
1734
1745
  var loadedKeys = q.loaded[l];
1735
1746
  if (loadedKeys.length) {
1736
- loadedKeys.forEach(function (ns) {
1737
- if (loaded[l][ns] === undefined) loaded[l][ns] = true;
1747
+ loadedKeys.forEach(function (n) {
1748
+ if (loaded[l][n] === undefined) loaded[l][n] = true;
1738
1749
  });
1739
1750
  }
1740
1751
  });
@@ -2316,7 +2327,14 @@ var I18n = function (_EventEmitter) {
2316
2327
  options.ns = options.ns || fixedT.ns;
2317
2328
  options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
2318
2329
  var keySeparator = _this5.options.keySeparator || '.';
2319
- var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2330
+ var resultKey;
2331
+ if (options.keyPrefix && Array.isArray(key)) {
2332
+ resultKey = key.map(function (k) {
2333
+ return "".concat(options.keyPrefix).concat(keySeparator).concat(k);
2334
+ });
2335
+ } else {
2336
+ resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2337
+ }
2320
2338
  return _this5.t(resultKey, options);
2321
2339
  };
2322
2340
  if (typeof lng === 'string') {
@@ -2381,7 +2399,7 @@ var I18n = function (_EventEmitter) {
2381
2399
  var _this7 = this;
2382
2400
  var deferred = defer();
2383
2401
  if (!this.options.ns) {
2384
- callback && callback();
2402
+ if (callback) callback();
2385
2403
  return Promise.resolve();
2386
2404
  }
2387
2405
  if (typeof ns === 'string') ns = [ns];
@@ -732,14 +732,24 @@ var Translator = function (_EventEmitter) {
732
732
  if (appendNamespaceToCIMode) {
733
733
  var nsSeparator = options.nsSeparator || this.options.nsSeparator;
734
734
  if (returnDetails) {
735
- resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
736
- return resolved;
735
+ return {
736
+ res: "".concat(namespace).concat(nsSeparator).concat(key),
737
+ usedKey: key,
738
+ exactUsedKey: key,
739
+ usedLng: lng,
740
+ usedNS: namespace
741
+ };
737
742
  }
738
743
  return "".concat(namespace).concat(nsSeparator).concat(key);
739
744
  }
740
745
  if (returnDetails) {
741
- resolved.res = key;
742
- return resolved;
746
+ return {
747
+ res: key,
748
+ usedKey: key,
749
+ exactUsedKey: key,
750
+ usedLng: lng,
751
+ usedNS: namespace
752
+ };
743
753
  }
744
754
  return key;
745
755
  }
@@ -1536,7 +1546,7 @@ var Interpolator = function () {
1536
1546
  if (typeof missingInterpolationHandler === 'function') {
1537
1547
  var temp = missingInterpolationHandler(str, match, options);
1538
1548
  value = typeof temp === 'string' ? temp : '';
1539
- } else if (options && options.hasOwnProperty(matchedVar)) {
1549
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1540
1550
  value = '';
1541
1551
  } else if (skipOnVariables) {
1542
1552
  value = match[0];
@@ -1683,34 +1693,34 @@ var Formatter = function () {
1683
1693
  this.logger = baseLogger.create('formatter');
1684
1694
  this.options = options;
1685
1695
  this.formats = {
1686
- number: createCachedFormatter(function (lng, options) {
1687
- var formatter = new Intl.NumberFormat(lng, options);
1696
+ number: createCachedFormatter(function (lng, opt) {
1697
+ var formatter = new Intl.NumberFormat(lng, _objectSpread2({}, opt));
1688
1698
  return function (val) {
1689
1699
  return formatter.format(val);
1690
1700
  };
1691
1701
  }),
1692
- currency: createCachedFormatter(function (lng, options) {
1693
- var formatter = new Intl.NumberFormat(lng, _objectSpread2(_objectSpread2({}, options), {}, {
1702
+ currency: createCachedFormatter(function (lng, opt) {
1703
+ var formatter = new Intl.NumberFormat(lng, _objectSpread2(_objectSpread2({}, opt), {}, {
1694
1704
  style: 'currency'
1695
1705
  }));
1696
1706
  return function (val) {
1697
1707
  return formatter.format(val);
1698
1708
  };
1699
1709
  }),
1700
- datetime: createCachedFormatter(function (lng, options) {
1701
- var formatter = new Intl.DateTimeFormat(lng, _objectSpread2({}, options));
1710
+ datetime: createCachedFormatter(function (lng, opt) {
1711
+ var formatter = new Intl.DateTimeFormat(lng, _objectSpread2({}, opt));
1702
1712
  return function (val) {
1703
1713
  return formatter.format(val);
1704
1714
  };
1705
1715
  }),
1706
- relativetime: createCachedFormatter(function (lng, options) {
1707
- var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread2({}, options));
1716
+ relativetime: createCachedFormatter(function (lng, opt) {
1717
+ var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread2({}, opt));
1708
1718
  return function (val) {
1709
- return formatter.format(val, options.range || 'day');
1719
+ return formatter.format(val, opt.range || 'day');
1710
1720
  };
1711
1721
  }),
1712
- list: createCachedFormatter(function (lng, options) {
1713
- var formatter = new Intl.ListFormat(lng, _objectSpread2({}, options));
1722
+ list: createCachedFormatter(function (lng, opt) {
1723
+ var formatter = new Intl.ListFormat(lng, _objectSpread2({}, opt));
1714
1724
  return function (val) {
1715
1725
  return formatter.format(val);
1716
1726
  };
@@ -1739,8 +1749,9 @@ var Formatter = function () {
1739
1749
  }
1740
1750
  }, {
1741
1751
  key: "format",
1742
- value: function format(value, _format, lng, options) {
1752
+ value: function format(value, _format, lng) {
1743
1753
  var _this = this;
1754
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1744
1755
  var formats = _format.split(this.formatSeparator);
1745
1756
  var result = formats.reduce(function (mem, f) {
1746
1757
  var _parseFormatStr = parseFormatStr(f),
@@ -1865,8 +1876,8 @@ var Connector = function (_EventEmitter) {
1865
1876
  if (!loaded[l]) loaded[l] = {};
1866
1877
  var loadedKeys = q.loaded[l];
1867
1878
  if (loadedKeys.length) {
1868
- loadedKeys.forEach(function (ns) {
1869
- if (loaded[l][ns] === undefined) loaded[l][ns] = true;
1879
+ loadedKeys.forEach(function (n) {
1880
+ if (loaded[l][n] === undefined) loaded[l][n] = true;
1870
1881
  });
1871
1882
  }
1872
1883
  });
@@ -2444,7 +2455,14 @@ var I18n = function (_EventEmitter) {
2444
2455
  options.ns = options.ns || fixedT.ns;
2445
2456
  options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
2446
2457
  var keySeparator = _this5.options.keySeparator || '.';
2447
- var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2458
+ var resultKey;
2459
+ if (options.keyPrefix && Array.isArray(key)) {
2460
+ resultKey = key.map(function (k) {
2461
+ return "".concat(options.keyPrefix).concat(keySeparator).concat(k);
2462
+ });
2463
+ } else {
2464
+ resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2465
+ }
2448
2466
  return _this5.t(resultKey, options);
2449
2467
  };
2450
2468
  if (typeof lng === 'string') {
@@ -2509,7 +2527,7 @@ var I18n = function (_EventEmitter) {
2509
2527
  var _this7 = this;
2510
2528
  var deferred = defer();
2511
2529
  if (!this.options.ns) {
2512
- callback && callback();
2530
+ if (callback) callback();
2513
2531
  return Promise.resolve();
2514
2532
  }
2515
2533
  if (typeof ns === 'string') ns = [ns];
@@ -578,14 +578,24 @@ var Translator = function (_EventEmitter) {
578
578
  if (appendNamespaceToCIMode) {
579
579
  var nsSeparator = options.nsSeparator || this.options.nsSeparator;
580
580
  if (returnDetails) {
581
- resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
582
- return resolved;
581
+ return {
582
+ res: "".concat(namespace).concat(nsSeparator).concat(key),
583
+ usedKey: key,
584
+ exactUsedKey: key,
585
+ usedLng: lng,
586
+ usedNS: namespace
587
+ };
583
588
  }
584
589
  return "".concat(namespace).concat(nsSeparator).concat(key);
585
590
  }
586
591
  if (returnDetails) {
587
- resolved.res = key;
588
- return resolved;
592
+ return {
593
+ res: key,
594
+ usedKey: key,
595
+ exactUsedKey: key,
596
+ usedLng: lng,
597
+ usedNS: namespace
598
+ };
589
599
  }
590
600
  return key;
591
601
  }
@@ -1384,7 +1394,7 @@ var Interpolator = function () {
1384
1394
  if (typeof missingInterpolationHandler === 'function') {
1385
1395
  var temp = missingInterpolationHandler(str, match, options);
1386
1396
  value = typeof temp === 'string' ? temp : '';
1387
- } else if (options && options.hasOwnProperty(matchedVar)) {
1397
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1388
1398
  value = '';
1389
1399
  } else if (skipOnVariables) {
1390
1400
  value = match[0];
@@ -1533,34 +1543,34 @@ var Formatter = function () {
1533
1543
  this.logger = baseLogger.create('formatter');
1534
1544
  this.options = options;
1535
1545
  this.formats = {
1536
- number: createCachedFormatter(function (lng, options) {
1537
- var formatter = new Intl.NumberFormat(lng, options);
1546
+ number: createCachedFormatter(function (lng, opt) {
1547
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
1538
1548
  return function (val) {
1539
1549
  return formatter.format(val);
1540
1550
  };
1541
1551
  }),
1542
- currency: createCachedFormatter(function (lng, options) {
1543
- var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, options), {}, {
1552
+ currency: createCachedFormatter(function (lng, opt) {
1553
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
1544
1554
  style: 'currency'
1545
1555
  }));
1546
1556
  return function (val) {
1547
1557
  return formatter.format(val);
1548
1558
  };
1549
1559
  }),
1550
- datetime: createCachedFormatter(function (lng, options) {
1551
- var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, options));
1560
+ datetime: createCachedFormatter(function (lng, opt) {
1561
+ var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
1552
1562
  return function (val) {
1553
1563
  return formatter.format(val);
1554
1564
  };
1555
1565
  }),
1556
- relativetime: createCachedFormatter(function (lng, options) {
1557
- var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, options));
1566
+ relativetime: createCachedFormatter(function (lng, opt) {
1567
+ var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
1558
1568
  return function (val) {
1559
- return formatter.format(val, options.range || 'day');
1569
+ return formatter.format(val, opt.range || 'day');
1560
1570
  };
1561
1571
  }),
1562
- list: createCachedFormatter(function (lng, options) {
1563
- var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, options));
1572
+ list: createCachedFormatter(function (lng, opt) {
1573
+ var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
1564
1574
  return function (val) {
1565
1575
  return formatter.format(val);
1566
1576
  };
@@ -1589,8 +1599,9 @@ var Formatter = function () {
1589
1599
  }
1590
1600
  }, {
1591
1601
  key: "format",
1592
- value: function format(value, _format, lng, options) {
1602
+ value: function format(value, _format, lng) {
1593
1603
  var _this = this;
1604
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1594
1605
  var formats = _format.split(this.formatSeparator);
1595
1606
  var result = formats.reduce(function (mem, f) {
1596
1607
  var _parseFormatStr = parseFormatStr(f),
@@ -1719,8 +1730,8 @@ var Connector = function (_EventEmitter) {
1719
1730
  if (!loaded[l]) loaded[l] = {};
1720
1731
  var loadedKeys = q.loaded[l];
1721
1732
  if (loadedKeys.length) {
1722
- loadedKeys.forEach(function (ns) {
1723
- if (loaded[l][ns] === undefined) loaded[l][ns] = true;
1733
+ loadedKeys.forEach(function (n) {
1734
+ if (loaded[l][n] === undefined) loaded[l][n] = true;
1724
1735
  });
1725
1736
  }
1726
1737
  });
@@ -2302,7 +2313,14 @@ var I18n = function (_EventEmitter) {
2302
2313
  options.ns = options.ns || fixedT.ns;
2303
2314
  options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
2304
2315
  var keySeparator = _this5.options.keySeparator || '.';
2305
- var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2316
+ var resultKey;
2317
+ if (options.keyPrefix && Array.isArray(key)) {
2318
+ resultKey = key.map(function (k) {
2319
+ return "".concat(options.keyPrefix).concat(keySeparator).concat(k);
2320
+ });
2321
+ } else {
2322
+ resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2323
+ }
2306
2324
  return _this5.t(resultKey, options);
2307
2325
  };
2308
2326
  if (typeof lng === 'string') {
@@ -2367,7 +2385,7 @@ var I18n = function (_EventEmitter) {
2367
2385
  var _this7 = this;
2368
2386
  var deferred = defer();
2369
2387
  if (!this.options.ns) {
2370
- callback && callback();
2388
+ if (callback) callback();
2371
2389
  return Promise.resolve();
2372
2390
  }
2373
2391
  if (typeof ns === 'string') ns = [ns];
@@ -1 +1 @@
1
- {"type":"module","version":"22.4.8"}
1
+ {"type":"module","version":"22.4.10"}
@@ -687,14 +687,24 @@
687
687
  if (appendNamespaceToCIMode) {
688
688
  var nsSeparator = options.nsSeparator || this.options.nsSeparator;
689
689
  if (returnDetails) {
690
- resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
691
- return resolved;
690
+ return {
691
+ res: "".concat(namespace).concat(nsSeparator).concat(key),
692
+ usedKey: key,
693
+ exactUsedKey: key,
694
+ usedLng: lng,
695
+ usedNS: namespace
696
+ };
692
697
  }
693
698
  return "".concat(namespace).concat(nsSeparator).concat(key);
694
699
  }
695
700
  if (returnDetails) {
696
- resolved.res = key;
697
- return resolved;
701
+ return {
702
+ res: key,
703
+ usedKey: key,
704
+ exactUsedKey: key,
705
+ usedLng: lng,
706
+ usedNS: namespace
707
+ };
698
708
  }
699
709
  return key;
700
710
  }
@@ -1493,7 +1503,7 @@
1493
1503
  if (typeof missingInterpolationHandler === 'function') {
1494
1504
  var temp = missingInterpolationHandler(str, match, options);
1495
1505
  value = typeof temp === 'string' ? temp : '';
1496
- } else if (options && options.hasOwnProperty(matchedVar)) {
1506
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1497
1507
  value = '';
1498
1508
  } else if (skipOnVariables) {
1499
1509
  value = match[0];
@@ -1599,9 +1609,7 @@
1599
1609
 
1600
1610
  function _arrayLikeToArray(arr, len) {
1601
1611
  if (len == null || len > arr.length) len = arr.length;
1602
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
1603
- arr2[i] = arr[i];
1604
- }
1612
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1605
1613
  return arr2;
1606
1614
  }
1607
1615
 
@@ -1675,34 +1683,34 @@
1675
1683
  this.logger = baseLogger.create('formatter');
1676
1684
  this.options = options;
1677
1685
  this.formats = {
1678
- number: createCachedFormatter(function (lng, options) {
1679
- var formatter = new Intl.NumberFormat(lng, options);
1686
+ number: createCachedFormatter(function (lng, opt) {
1687
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
1680
1688
  return function (val) {
1681
1689
  return formatter.format(val);
1682
1690
  };
1683
1691
  }),
1684
- currency: createCachedFormatter(function (lng, options) {
1685
- var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, options), {}, {
1692
+ currency: createCachedFormatter(function (lng, opt) {
1693
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
1686
1694
  style: 'currency'
1687
1695
  }));
1688
1696
  return function (val) {
1689
1697
  return formatter.format(val);
1690
1698
  };
1691
1699
  }),
1692
- datetime: createCachedFormatter(function (lng, options) {
1693
- var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, options));
1700
+ datetime: createCachedFormatter(function (lng, opt) {
1701
+ var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
1694
1702
  return function (val) {
1695
1703
  return formatter.format(val);
1696
1704
  };
1697
1705
  }),
1698
- relativetime: createCachedFormatter(function (lng, options) {
1699
- var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, options));
1706
+ relativetime: createCachedFormatter(function (lng, opt) {
1707
+ var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
1700
1708
  return function (val) {
1701
- return formatter.format(val, options.range || 'day');
1709
+ return formatter.format(val, opt.range || 'day');
1702
1710
  };
1703
1711
  }),
1704
- list: createCachedFormatter(function (lng, options) {
1705
- var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, options));
1712
+ list: createCachedFormatter(function (lng, opt) {
1713
+ var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
1706
1714
  return function (val) {
1707
1715
  return formatter.format(val);
1708
1716
  };
@@ -1731,8 +1739,9 @@
1731
1739
  }
1732
1740
  }, {
1733
1741
  key: "format",
1734
- value: function format(value, _format, lng, options) {
1742
+ value: function format(value, _format, lng) {
1735
1743
  var _this = this;
1744
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1736
1745
  var formats = _format.split(this.formatSeparator);
1737
1746
  var result = formats.reduce(function (mem, f) {
1738
1747
  var _parseFormatStr = parseFormatStr(f),
@@ -1861,8 +1870,8 @@
1861
1870
  if (!loaded[l]) loaded[l] = {};
1862
1871
  var loadedKeys = q.loaded[l];
1863
1872
  if (loadedKeys.length) {
1864
- loadedKeys.forEach(function (ns) {
1865
- if (loaded[l][ns] === undefined) loaded[l][ns] = true;
1873
+ loadedKeys.forEach(function (n) {
1874
+ if (loaded[l][n] === undefined) loaded[l][n] = true;
1866
1875
  });
1867
1876
  }
1868
1877
  });
@@ -2444,7 +2453,14 @@
2444
2453
  options.ns = options.ns || fixedT.ns;
2445
2454
  options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
2446
2455
  var keySeparator = _this5.options.keySeparator || '.';
2447
- var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2456
+ var resultKey;
2457
+ if (options.keyPrefix && Array.isArray(key)) {
2458
+ resultKey = key.map(function (k) {
2459
+ return "".concat(options.keyPrefix).concat(keySeparator).concat(k);
2460
+ });
2461
+ } else {
2462
+ resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2463
+ }
2448
2464
  return _this5.t(resultKey, options);
2449
2465
  };
2450
2466
  if (typeof lng === 'string') {
@@ -2509,7 +2525,7 @@
2509
2525
  var _this7 = this;
2510
2526
  var deferred = defer();
2511
2527
  if (!this.options.ns) {
2512
- callback && callback();
2528
+ if (callback) callback();
2513
2529
  return Promise.resolve();
2514
2530
  }
2515
2531
  if (typeof ns === 'string') ns = [ns];