i18next 22.0.7 → 22.1.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.
@@ -22,10 +22,8 @@ var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeO
22
22
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
23
23
  var _toArray__default = /*#__PURE__*/_interopDefaultLegacy(_toArray);
24
24
 
25
- 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; }
26
-
27
- 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__default['default'](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; }
28
-
25
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
26
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
27
  var consoleLogger = {
30
28
  type: 'logger',
31
29
  log: function log(args) {
@@ -41,17 +39,13 @@ var consoleLogger = {
41
39
  if (console && console[type]) console[type].apply(console, args);
42
40
  }
43
41
  };
44
-
45
42
  var Logger = function () {
46
43
  function Logger(concreteLogger) {
47
44
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
48
-
49
- _classCallCheck__default['default'](this, Logger);
50
-
45
+ _classCallCheck__default["default"](this, Logger);
51
46
  this.init(concreteLogger, options);
52
47
  }
53
-
54
- _createClass__default['default'](Logger, [{
48
+ _createClass__default["default"](Logger, [{
55
49
  key: "init",
56
50
  value: function init(concreteLogger) {
57
51
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -71,7 +65,6 @@ var Logger = function () {
71
65
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
72
66
  args[_key] = arguments[_key];
73
67
  }
74
-
75
68
  return this.forward(args, 'log', '', true);
76
69
  }
77
70
  }, {
@@ -80,7 +73,6 @@ var Logger = function () {
80
73
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
81
74
  args[_key2] = arguments[_key2];
82
75
  }
83
-
84
76
  return this.forward(args, 'warn', '', true);
85
77
  }
86
78
  }, {
@@ -89,7 +81,6 @@ var Logger = function () {
89
81
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
90
82
  args[_key3] = arguments[_key3];
91
83
  }
92
-
93
84
  return this.forward(args, 'error', '');
94
85
  }
95
86
  }, {
@@ -98,7 +89,6 @@ var Logger = function () {
98
89
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
99
90
  args[_key4] = arguments[_key4];
100
91
  }
101
-
102
92
  return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
103
93
  }
104
94
  }, {
@@ -111,7 +101,7 @@ var Logger = function () {
111
101
  }, {
112
102
  key: "create",
113
103
  value: function create(moduleName) {
114
- return new Logger(this.logger, _objectSpread(_objectSpread({}, {
104
+ return new Logger(this.logger, _objectSpread$6(_objectSpread$6({}, {
115
105
  prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
116
106
  }), this.options));
117
107
  }
@@ -123,27 +113,21 @@ var Logger = function () {
123
113
  return new Logger(this.logger, options);
124
114
  }
125
115
  }]);
126
-
127
116
  return Logger;
128
117
  }();
129
-
130
118
  var baseLogger = new Logger();
131
119
 
132
120
  var EventEmitter = function () {
133
121
  function EventEmitter() {
134
- _classCallCheck__default['default'](this, EventEmitter);
135
-
122
+ _classCallCheck__default["default"](this, EventEmitter);
136
123
  this.observers = {};
137
124
  }
138
-
139
- _createClass__default['default'](EventEmitter, [{
125
+ _createClass__default["default"](EventEmitter, [{
140
126
  key: "on",
141
127
  value: function on(events, listener) {
142
128
  var _this = this;
143
-
144
129
  events.split(' ').forEach(function (event) {
145
130
  _this.observers[event] = _this.observers[event] || [];
146
-
147
131
  _this.observers[event].push(listener);
148
132
  });
149
133
  return this;
@@ -152,12 +136,10 @@ var EventEmitter = function () {
152
136
  key: "off",
153
137
  value: function off(event, listener) {
154
138
  if (!this.observers[event]) return;
155
-
156
139
  if (!listener) {
157
140
  delete this.observers[event];
158
141
  return;
159
142
  }
160
-
161
143
  this.observers[event] = this.observers[event].filter(function (l) {
162
144
  return l !== listener;
163
145
  });
@@ -168,24 +150,20 @@ var EventEmitter = function () {
168
150
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
169
151
  args[_key - 1] = arguments[_key];
170
152
  }
171
-
172
153
  if (this.observers[event]) {
173
154
  var cloned = [].concat(this.observers[event]);
174
155
  cloned.forEach(function (observer) {
175
156
  observer.apply(void 0, args);
176
157
  });
177
158
  }
178
-
179
159
  if (this.observers['*']) {
180
160
  var _cloned = [].concat(this.observers['*']);
181
-
182
161
  _cloned.forEach(function (observer) {
183
162
  observer.apply(observer, [event].concat(args));
184
163
  });
185
164
  }
186
165
  }
187
166
  }]);
188
-
189
167
  return EventEmitter;
190
168
  }();
191
169
 
@@ -209,68 +187,56 @@ function copy(a, s, t) {
209
187
  if (s[m]) t[m] = s[m];
210
188
  });
211
189
  }
212
-
213
190
  function getLastOfPath(object, path, Empty) {
214
191
  function cleanKey(key) {
215
192
  return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
216
193
  }
217
-
218
194
  function canNotTraverseDeeper() {
219
195
  return !object || typeof object === 'string';
220
196
  }
221
-
222
197
  var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
223
-
224
198
  while (stack.length > 1) {
225
199
  if (canNotTraverseDeeper()) return {};
226
200
  var key = cleanKey(stack.shift());
227
201
  if (!object[key] && Empty) object[key] = new Empty();
228
-
229
202
  if (Object.prototype.hasOwnProperty.call(object, key)) {
230
203
  object = object[key];
231
204
  } else {
232
205
  object = {};
233
206
  }
234
207
  }
235
-
236
208
  if (canNotTraverseDeeper()) return {};
237
209
  return {
238
210
  obj: object,
239
211
  k: cleanKey(stack.shift())
240
212
  };
241
213
  }
242
-
243
214
  function setPath(object, path, newValue) {
244
215
  var _getLastOfPath = getLastOfPath(object, path, Object),
245
- obj = _getLastOfPath.obj,
246
- k = _getLastOfPath.k;
247
-
216
+ obj = _getLastOfPath.obj,
217
+ k = _getLastOfPath.k;
248
218
  obj[k] = newValue;
249
219
  }
250
220
  function pushPath(object, path, newValue, concat) {
251
221
  var _getLastOfPath2 = getLastOfPath(object, path, Object),
252
- obj = _getLastOfPath2.obj,
253
- k = _getLastOfPath2.k;
254
-
222
+ obj = _getLastOfPath2.obj,
223
+ k = _getLastOfPath2.k;
255
224
  obj[k] = obj[k] || [];
256
225
  if (concat) obj[k] = obj[k].concat(newValue);
257
226
  if (!concat) obj[k].push(newValue);
258
227
  }
259
228
  function getPath(object, path) {
260
229
  var _getLastOfPath3 = getLastOfPath(object, path),
261
- obj = _getLastOfPath3.obj,
262
- k = _getLastOfPath3.k;
263
-
230
+ obj = _getLastOfPath3.obj,
231
+ k = _getLastOfPath3.k;
264
232
  if (!obj) return undefined;
265
233
  return obj[k];
266
234
  }
267
235
  function getPathWithDefaults(data, defaultData, key) {
268
236
  var value = getPath(data, key);
269
-
270
237
  if (value !== undefined) {
271
238
  return value;
272
239
  }
273
-
274
240
  return getPath(defaultData, key);
275
241
  }
276
242
  function deepExtend(target, source, overwrite) {
@@ -287,7 +253,6 @@ function deepExtend(target, source, overwrite) {
287
253
  }
288
254
  }
289
255
  }
290
-
291
256
  return target;
292
257
  }
293
258
  function regexEscape(str) {
@@ -307,7 +272,6 @@ function escape(data) {
307
272
  return _entityMap[s];
308
273
  });
309
274
  }
310
-
311
275
  return data;
312
276
  }
313
277
  var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
@@ -323,106 +287,78 @@ function looksLikeObjectPath(key, nsSeparator, keySeparator) {
323
287
  return c === '?' ? '\\?' : c;
324
288
  }).join('|'), ")"));
325
289
  var matched = !r.test(key);
326
-
327
290
  if (!matched) {
328
291
  var ki = key.indexOf(keySeparator);
329
-
330
292
  if (ki > 0 && !r.test(key.substring(0, ki))) {
331
293
  matched = true;
332
294
  }
333
295
  }
334
-
335
296
  return matched;
336
297
  }
337
298
 
338
- 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; }
339
-
340
- 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__default['default'](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; }
341
-
342
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
343
-
344
- 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; } }
345
-
299
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
300
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
301
+ function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
302
+ 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; } }
346
303
  function deepFind(obj, path) {
347
304
  var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
348
305
  if (!obj) return undefined;
349
306
  if (obj[path]) return obj[path];
350
307
  var paths = path.split(keySeparator);
351
308
  var current = obj;
352
-
353
309
  for (var i = 0; i < paths.length; ++i) {
354
310
  if (!current) return undefined;
355
-
356
311
  if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
357
312
  return undefined;
358
313
  }
359
-
360
314
  if (current[paths[i]] === undefined) {
361
315
  var j = 2;
362
316
  var p = paths.slice(i, i + j).join(keySeparator);
363
317
  var mix = current[p];
364
-
365
318
  while (mix === undefined && paths.length > i + j) {
366
319
  j++;
367
320
  p = paths.slice(i, i + j).join(keySeparator);
368
321
  mix = current[p];
369
322
  }
370
-
371
323
  if (mix === undefined) return undefined;
372
324
  if (mix === null) return null;
373
-
374
325
  if (path.endsWith(p)) {
375
326
  if (typeof mix === 'string') return mix;
376
327
  if (p && typeof mix[p] === 'string') return mix[p];
377
328
  }
378
-
379
329
  var joinedPath = paths.slice(i + j).join(keySeparator);
380
330
  if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
381
331
  return undefined;
382
332
  }
383
-
384
333
  current = current[paths[i]];
385
334
  }
386
-
387
335
  return current;
388
336
  }
389
-
390
337
  var ResourceStore = function (_EventEmitter) {
391
- _inherits__default['default'](ResourceStore, _EventEmitter);
392
-
393
- var _super = _createSuper(ResourceStore);
394
-
338
+ _inherits__default["default"](ResourceStore, _EventEmitter);
339
+ var _super = _createSuper$3(ResourceStore);
395
340
  function ResourceStore(data) {
396
341
  var _this;
397
-
398
342
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
399
343
  ns: ['translation'],
400
344
  defaultNS: 'translation'
401
345
  };
402
-
403
- _classCallCheck__default['default'](this, ResourceStore);
404
-
346
+ _classCallCheck__default["default"](this, ResourceStore);
405
347
  _this = _super.call(this);
406
-
407
348
  if (isIE10) {
408
- EventEmitter.call(_assertThisInitialized__default['default'](_this));
349
+ EventEmitter.call(_assertThisInitialized__default["default"](_this));
409
350
  }
410
-
411
351
  _this.data = data || {};
412
352
  _this.options = options;
413
-
414
353
  if (_this.options.keySeparator === undefined) {
415
354
  _this.options.keySeparator = '.';
416
355
  }
417
-
418
356
  if (_this.options.ignoreJSONStructure === undefined) {
419
357
  _this.options.ignoreJSONStructure = true;
420
358
  }
421
-
422
359
  return _this;
423
360
  }
424
-
425
- _createClass__default['default'](ResourceStore, [{
361
+ _createClass__default["default"](ResourceStore, [{
426
362
  key: "addNamespaces",
427
363
  value: function addNamespaces(ns) {
428
364
  if (this.options.ns.indexOf(ns) < 0) {
@@ -433,7 +369,6 @@ var ResourceStore = function (_EventEmitter) {
433
369
  key: "removeNamespaces",
434
370
  value: function removeNamespaces(ns) {
435
371
  var index = this.options.ns.indexOf(ns);
436
-
437
372
  if (index > -1) {
438
373
  this.options.ns.splice(index, 1);
439
374
  }
@@ -447,11 +382,9 @@ var ResourceStore = function (_EventEmitter) {
447
382
  var path = [lng, ns];
448
383
  if (key && typeof key !== 'string') path = path.concat(key);
449
384
  if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
450
-
451
385
  if (lng.indexOf('.') > -1) {
452
386
  path = lng.split('.');
453
387
  }
454
-
455
388
  var result = getPath(this.data, path);
456
389
  if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
457
390
  return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
@@ -466,13 +399,11 @@ var ResourceStore = function (_EventEmitter) {
466
399
  if (keySeparator === undefined) keySeparator = '.';
467
400
  var path = [lng, ns];
468
401
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
469
-
470
402
  if (lng.indexOf('.') > -1) {
471
403
  path = lng.split('.');
472
404
  value = ns;
473
405
  ns = path[1];
474
406
  }
475
-
476
407
  this.addNamespaces(ns);
477
408
  setPath(this.data, path, value);
478
409
  if (!options.silent) this.emit('added', lng, ns, key, value);
@@ -483,13 +414,11 @@ var ResourceStore = function (_EventEmitter) {
483
414
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
484
415
  silent: false
485
416
  };
486
-
487
417
  for (var m in resources) {
488
418
  if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
489
419
  silent: true
490
420
  });
491
421
  }
492
-
493
422
  if (!options.silent) this.emit('added', lng, ns, resources);
494
423
  }
495
424
  }, {
@@ -499,23 +428,19 @@ var ResourceStore = function (_EventEmitter) {
499
428
  silent: false
500
429
  };
501
430
  var path = [lng, ns];
502
-
503
431
  if (lng.indexOf('.') > -1) {
504
432
  path = lng.split('.');
505
433
  deep = resources;
506
434
  resources = ns;
507
435
  ns = path[1];
508
436
  }
509
-
510
437
  this.addNamespaces(ns);
511
438
  var pack = getPath(this.data, path) || {};
512
-
513
439
  if (deep) {
514
440
  deepExtend(pack, resources, overwrite);
515
441
  } else {
516
- pack = _objectSpread$1(_objectSpread$1({}, pack), resources);
442
+ pack = _objectSpread$5(_objectSpread$5({}, pack), resources);
517
443
  }
518
-
519
444
  setPath(this.data, path, pack);
520
445
  if (!options.silent) this.emit('added', lng, ns, resources);
521
446
  }
@@ -525,7 +450,6 @@ var ResourceStore = function (_EventEmitter) {
525
450
  if (this.hasResourceBundle(lng, ns)) {
526
451
  delete this.data[lng][ns];
527
452
  }
528
-
529
453
  this.removeNamespaces(ns);
530
454
  this.emit('removed', lng, ns);
531
455
  }
@@ -538,7 +462,7 @@ var ResourceStore = function (_EventEmitter) {
538
462
  key: "getResourceBundle",
539
463
  value: function getResourceBundle(lng, ns) {
540
464
  if (!ns) ns = this.options.defaultNS;
541
- if (this.options.compatibilityAPI === 'v1') return _objectSpread$1(_objectSpread$1({}, {}), this.getResource(lng, ns));
465
+ if (this.options.compatibilityAPI === 'v1') return _objectSpread$5(_objectSpread$5({}, {}), this.getResource(lng, ns));
542
466
  return this.getResource(lng, ns);
543
467
  }
544
468
  }, {
@@ -561,7 +485,6 @@ var ResourceStore = function (_EventEmitter) {
561
485
  return this.data;
562
486
  }
563
487
  }]);
564
-
565
488
  return ResourceStore;
566
489
  }(EventEmitter);
567
490
 
@@ -572,7 +495,6 @@ var postProcessor = {
572
495
  },
573
496
  handle: function handle(processors, value, key, options, translator) {
574
497
  var _this = this;
575
-
576
498
  processors.forEach(function (processor) {
577
499
  if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
578
500
  });
@@ -580,45 +502,31 @@ var postProcessor = {
580
502
  }
581
503
  };
582
504
 
583
- 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; }
584
-
585
- 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__default['default'](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; }
586
-
587
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
588
-
589
- 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; } }
505
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
506
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
507
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
508
+ 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; } }
590
509
  var checkedLoadedFor = {};
591
-
592
510
  var Translator = function (_EventEmitter) {
593
- _inherits__default['default'](Translator, _EventEmitter);
594
-
595
- var _super = _createSuper$1(Translator);
596
-
511
+ _inherits__default["default"](Translator, _EventEmitter);
512
+ var _super = _createSuper$2(Translator);
597
513
  function Translator(services) {
598
514
  var _this;
599
-
600
515
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
601
-
602
- _classCallCheck__default['default'](this, Translator);
603
-
516
+ _classCallCheck__default["default"](this, Translator);
604
517
  _this = _super.call(this);
605
-
606
518
  if (isIE10) {
607
- EventEmitter.call(_assertThisInitialized__default['default'](_this));
519
+ EventEmitter.call(_assertThisInitialized__default["default"](_this));
608
520
  }
609
-
610
- copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized__default['default'](_this));
521
+ copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized__default["default"](_this));
611
522
  _this.options = options;
612
-
613
523
  if (_this.options.keySeparator === undefined) {
614
524
  _this.options.keySeparator = '.';
615
525
  }
616
-
617
526
  _this.logger = baseLogger.create('translator');
618
527
  return _this;
619
528
  }
620
-
621
- _createClass__default['default'](Translator, [{
529
+ _createClass__default["default"](Translator, [{
622
530
  key: "changeLanguage",
623
531
  value: function changeLanguage(lng) {
624
532
  if (lng) this.language = lng;
@@ -629,11 +537,9 @@ var Translator = function (_EventEmitter) {
629
537
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
630
538
  interpolation: {}
631
539
  };
632
-
633
540
  if (key === undefined || key === null) {
634
541
  return false;
635
542
  }
636
-
637
543
  var resolved = this.resolve(key, options);
638
544
  return resolved && resolved.res !== undefined;
639
545
  }
@@ -646,22 +552,18 @@ var Translator = function (_EventEmitter) {
646
552
  var namespaces = options.ns || this.options.defaultNS || [];
647
553
  var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
648
554
  var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
649
-
650
555
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
651
556
  var m = key.match(this.interpolator.nestingRegexp);
652
-
653
557
  if (m && m.length > 0) {
654
558
  return {
655
559
  key: key,
656
560
  namespaces: namespaces
657
561
  };
658
562
  }
659
-
660
563
  var parts = key.split(nsSeparator);
661
564
  if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
662
565
  key = parts.join(keySeparator);
663
566
  }
664
-
665
567
  if (typeof namespaces === 'string') namespaces = [namespaces];
666
568
  return {
667
569
  key: key,
@@ -672,45 +574,35 @@ var Translator = function (_EventEmitter) {
672
574
  key: "translate",
673
575
  value: function translate(keys, options, lastKey) {
674
576
  var _this2 = this;
675
-
676
- if (_typeof__default['default'](options) !== 'object' && this.options.overloadTranslationOptionHandler) {
577
+ if (_typeof__default["default"](options) !== 'object' && this.options.overloadTranslationOptionHandler) {
677
578
  options = this.options.overloadTranslationOptionHandler(arguments);
678
579
  }
679
-
680
580
  if (!options) options = {};
681
581
  if (keys === undefined || keys === null) return '';
682
582
  if (!Array.isArray(keys)) keys = [String(keys)];
683
583
  var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
684
584
  var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
685
-
686
585
  var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options),
687
- key = _this$extractFromKey.key,
688
- namespaces = _this$extractFromKey.namespaces;
689
-
586
+ key = _this$extractFromKey.key,
587
+ namespaces = _this$extractFromKey.namespaces;
690
588
  var namespace = namespaces[namespaces.length - 1];
691
589
  var lng = options.lng || this.language;
692
590
  var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
693
-
694
591
  if (lng && lng.toLowerCase() === 'cimode') {
695
592
  if (appendNamespaceToCIMode) {
696
593
  var nsSeparator = options.nsSeparator || this.options.nsSeparator;
697
-
698
594
  if (returnDetails) {
699
595
  resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
700
596
  return resolved;
701
597
  }
702
-
703
598
  return "".concat(namespace).concat(nsSeparator).concat(key);
704
599
  }
705
-
706
600
  if (returnDetails) {
707
601
  resolved.res = key;
708
602
  return resolved;
709
603
  }
710
-
711
604
  return key;
712
605
  }
713
-
714
606
  var resolved = this.resolve(keys, options);
715
607
  var res = resolved && resolved.res;
716
608
  var resUsedKey = resolved && resolved.usedKey || key;
@@ -720,41 +612,34 @@ var Translator = function (_EventEmitter) {
720
612
  var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
721
613
  var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
722
614
  var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
723
-
724
615
  if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
725
616
  if (!options.returnObjects && !this.options.returnObjects) {
726
617
  if (!this.options.returnedObjectHandler) {
727
618
  this.logger.warn('accessing an object - but returnObjects options is not enabled!');
728
619
  }
729
-
730
- var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$2(_objectSpread$2({}, options), {}, {
620
+ var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4(_objectSpread$4({}, options), {}, {
731
621
  ns: namespaces
732
622
  })) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
733
-
734
623
  if (returnDetails) {
735
624
  resolved.res = r;
736
625
  return resolved;
737
626
  }
738
-
739
627
  return r;
740
628
  }
741
-
742
629
  if (keySeparator) {
743
630
  var resTypeIsArray = resType === '[object Array]';
744
631
  var copy = resTypeIsArray ? [] : {};
745
632
  var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
746
-
747
633
  for (var m in res) {
748
634
  if (Object.prototype.hasOwnProperty.call(res, m)) {
749
635
  var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m);
750
- copy[m] = this.translate(deepKey, _objectSpread$2(_objectSpread$2({}, options), {
636
+ copy[m] = this.translate(deepKey, _objectSpread$4(_objectSpread$4({}, options), {
751
637
  joinArrays: false,
752
638
  ns: namespaces
753
639
  }));
754
640
  if (copy[m] === deepKey) copy[m] = res[m];
755
641
  }
756
642
  }
757
-
758
643
  res = copy;
759
644
  }
760
645
  } else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
@@ -767,34 +652,27 @@ var Translator = function (_EventEmitter) {
767
652
  var hasDefaultValue = Translator.hasDefaultValue(options);
768
653
  var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
769
654
  var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
770
-
771
655
  if (!this.isValidLookup(res) && hasDefaultValue) {
772
656
  usedDefault = true;
773
657
  res = defaultValue;
774
658
  }
775
-
776
659
  if (!this.isValidLookup(res)) {
777
660
  usedKey = true;
778
661
  res = key;
779
662
  }
780
-
781
663
  var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
782
664
  var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
783
665
  var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
784
-
785
666
  if (usedKey || usedDefault || updateMissing) {
786
667
  this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
787
-
788
668
  if (keySeparator) {
789
- var fk = this.resolve(key, _objectSpread$2(_objectSpread$2({}, options), {}, {
669
+ var fk = this.resolve(key, _objectSpread$4(_objectSpread$4({}, options), {}, {
790
670
  keySeparator: false
791
671
  }));
792
672
  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.');
793
673
  }
794
-
795
674
  var lngs = [];
796
675
  var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
797
-
798
676
  if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
799
677
  for (var i = 0; i < fallbackLngs.length; i++) {
800
678
  lngs.push(fallbackLngs[i]);
@@ -804,19 +682,15 @@ var Translator = function (_EventEmitter) {
804
682
  } else {
805
683
  lngs.push(options.lng || this.language);
806
684
  }
807
-
808
685
  var send = function send(l, k, specificDefaultValue) {
809
686
  var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
810
-
811
687
  if (_this2.options.missingKeyHandler) {
812
688
  _this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
813
689
  } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
814
690
  _this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
815
691
  }
816
-
817
692
  _this2.emit('missingKey', l, namespace, k, res);
818
693
  };
819
-
820
694
  if (this.options.saveMissing) {
821
695
  if (this.options.saveMissingPlurals && needsPluralHandling) {
822
696
  lngs.forEach(function (language) {
@@ -829,10 +703,8 @@ var Translator = function (_EventEmitter) {
829
703
  }
830
704
  }
831
705
  }
832
-
833
706
  res = this.extendTranslation(res, keys, options, resolved, lastKey);
834
707
  if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key);
835
-
836
708
  if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
837
709
  if (this.options.compatibilityAPI !== 'v1') {
838
710
  res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
@@ -841,77 +713,63 @@ var Translator = function (_EventEmitter) {
841
713
  }
842
714
  }
843
715
  }
844
-
845
716
  if (returnDetails) {
846
717
  resolved.res = res;
847
718
  return resolved;
848
719
  }
849
-
850
720
  return res;
851
721
  }
852
722
  }, {
853
723
  key: "extendTranslation",
854
724
  value: function extendTranslation(res, key, options, resolved, lastKey) {
855
725
  var _this3 = this;
856
-
857
726
  if (this.i18nFormat && this.i18nFormat.parse) {
858
- res = this.i18nFormat.parse(res, _objectSpread$2(_objectSpread$2({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
727
+ res = this.i18nFormat.parse(res, _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
859
728
  resolved: resolved
860
729
  });
861
730
  } else if (!options.skipInterpolation) {
862
- if (options.interpolation) this.interpolator.init(_objectSpread$2(_objectSpread$2({}, options), {
863
- interpolation: _objectSpread$2(_objectSpread$2({}, this.options.interpolation), options.interpolation)
731
+ if (options.interpolation) this.interpolator.init(_objectSpread$4(_objectSpread$4({}, options), {
732
+ interpolation: _objectSpread$4(_objectSpread$4({}, this.options.interpolation), options.interpolation)
864
733
  }));
865
734
  var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
866
735
  var nestBef;
867
-
868
736
  if (skipOnVariables) {
869
737
  var nb = res.match(this.interpolator.nestingRegexp);
870
738
  nestBef = nb && nb.length;
871
739
  }
872
-
873
740
  var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
874
- if (this.options.interpolation.defaultVariables) data = _objectSpread$2(_objectSpread$2({}, this.options.interpolation.defaultVariables), data);
741
+ if (this.options.interpolation.defaultVariables) data = _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), data);
875
742
  res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
876
-
877
743
  if (skipOnVariables) {
878
744
  var na = res.match(this.interpolator.nestingRegexp);
879
745
  var nestAft = na && na.length;
880
746
  if (nestBef < nestAft) options.nest = false;
881
747
  }
882
-
883
748
  if (options.nest !== false) res = this.interpolator.nest(res, function () {
884
749
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
885
750
  args[_key] = arguments[_key];
886
751
  }
887
-
888
752
  if (lastKey && lastKey[0] === args[0] && !options.context) {
889
753
  _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
890
-
891
754
  return null;
892
755
  }
893
-
894
756
  return _this3.translate.apply(_this3, args.concat([key]));
895
757
  }, options);
896
758
  if (options.interpolation) this.interpolator.reset();
897
759
  }
898
-
899
760
  var postProcess = options.postProcess || this.options.postProcess;
900
761
  var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
901
-
902
762
  if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
903
- res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$2({
763
+ res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$4({
904
764
  i18nResolved: resolved
905
765
  }, options) : options, this);
906
766
  }
907
-
908
767
  return res;
909
768
  }
910
769
  }, {
911
770
  key: "resolve",
912
771
  value: function resolve(keys) {
913
772
  var _this4 = this;
914
-
915
773
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
916
774
  var found;
917
775
  var usedKey;
@@ -921,65 +779,50 @@ var Translator = function (_EventEmitter) {
921
779
  if (typeof keys === 'string') keys = [keys];
922
780
  keys.forEach(function (k) {
923
781
  if (_this4.isValidLookup(found)) return;
924
-
925
782
  var extracted = _this4.extractFromKey(k, options);
926
-
927
783
  var key = extracted.key;
928
784
  usedKey = key;
929
785
  var namespaces = extracted.namespaces;
930
786
  if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
931
787
  var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
932
-
933
788
  var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
934
-
935
789
  var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
936
790
  var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
937
791
  namespaces.forEach(function (ns) {
938
792
  if (_this4.isValidLookup(found)) return;
939
793
  usedNS = ns;
940
-
941
794
  if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
942
795
  checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
943
-
944
796
  _this4.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!!!');
945
797
  }
946
-
947
798
  codes.forEach(function (code) {
948
799
  if (_this4.isValidLookup(found)) return;
949
800
  usedLng = code;
950
801
  var finalKeys = [key];
951
-
952
802
  if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
953
803
  _this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
954
804
  } else {
955
805
  var pluralSuffix;
956
806
  if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
957
807
  var zeroSuffix = "".concat(_this4.options.pluralSeparator, "zero");
958
-
959
808
  if (needsPluralHandling) {
960
809
  finalKeys.push(key + pluralSuffix);
961
-
962
810
  if (needsZeroSuffixLookup) {
963
811
  finalKeys.push(key + zeroSuffix);
964
812
  }
965
813
  }
966
-
967
814
  if (needsContextHandling) {
968
815
  var contextKey = "".concat(key).concat(_this4.options.contextSeparator).concat(options.context);
969
816
  finalKeys.push(contextKey);
970
-
971
817
  if (needsPluralHandling) {
972
818
  finalKeys.push(contextKey + pluralSuffix);
973
-
974
819
  if (needsZeroSuffixLookup) {
975
820
  finalKeys.push(contextKey + zeroSuffix);
976
821
  }
977
822
  }
978
823
  }
979
824
  }
980
-
981
825
  var possibleKey;
982
-
983
826
  while (possibleKey = finalKeys.pop()) {
984
827
  if (!_this4.isValidLookup(found)) {
985
828
  exactUsedKey = possibleKey;
@@ -1013,34 +856,28 @@ var Translator = function (_EventEmitter) {
1013
856
  key: "hasDefaultValue",
1014
857
  value: function hasDefaultValue(options) {
1015
858
  var prefix = 'defaultValue';
1016
-
1017
859
  for (var option in options) {
1018
860
  if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
1019
861
  return true;
1020
862
  }
1021
863
  }
1022
-
1023
864
  return false;
1024
865
  }
1025
866
  }]);
1026
-
1027
867
  return Translator;
1028
868
  }(EventEmitter);
1029
869
 
1030
870
  function capitalize(string) {
1031
871
  return string.charAt(0).toUpperCase() + string.slice(1);
1032
872
  }
1033
-
1034
873
  var LanguageUtil = function () {
1035
874
  function LanguageUtil(options) {
1036
- _classCallCheck__default['default'](this, LanguageUtil);
1037
-
875
+ _classCallCheck__default["default"](this, LanguageUtil);
1038
876
  this.options = options;
1039
877
  this.supportedLngs = this.options.supportedLngs || false;
1040
878
  this.logger = baseLogger.create('languageUtils');
1041
879
  }
1042
-
1043
- _createClass__default['default'](LanguageUtil, [{
880
+ _createClass__default["default"](LanguageUtil, [{
1044
881
  key: "getScriptPartFromCode",
1045
882
  value: function getScriptPartFromCode(code) {
1046
883
  if (!code || code.indexOf('-') < 0) return null;
@@ -1063,7 +900,6 @@ var LanguageUtil = function () {
1063
900
  if (typeof code === 'string' && code.indexOf('-') > -1) {
1064
901
  var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
1065
902
  var p = code.split('-');
1066
-
1067
903
  if (this.options.lowerCaseLng) {
1068
904
  p = p.map(function (part) {
1069
905
  return part.toLowerCase();
@@ -1079,10 +915,8 @@ var LanguageUtil = function () {
1079
915
  if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
1080
916
  if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
1081
917
  }
1082
-
1083
918
  return p.join('-');
1084
919
  }
1085
-
1086
920
  return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
1087
921
  }
1088
922
  }, {
@@ -1091,37 +925,29 @@ var LanguageUtil = function () {
1091
925
  if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
1092
926
  code = this.getLanguagePartFromCode(code);
1093
927
  }
1094
-
1095
928
  return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
1096
929
  }
1097
930
  }, {
1098
931
  key: "getBestMatchFromCodes",
1099
932
  value: function getBestMatchFromCodes(codes) {
1100
933
  var _this = this;
1101
-
1102
934
  if (!codes) return null;
1103
935
  var found;
1104
936
  codes.forEach(function (code) {
1105
937
  if (found) return;
1106
-
1107
938
  var cleanedLng = _this.formatLanguageCode(code);
1108
-
1109
939
  if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
1110
940
  });
1111
-
1112
941
  if (!found && this.options.supportedLngs) {
1113
942
  codes.forEach(function (code) {
1114
943
  if (found) return;
1115
-
1116
944
  var lngOnly = _this.getLanguagePartFromCode(code);
1117
-
1118
945
  if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
1119
946
  found = _this.options.supportedLngs.find(function (supportedLng) {
1120
947
  if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
1121
948
  });
1122
949
  });
1123
950
  }
1124
-
1125
951
  if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
1126
952
  return found;
1127
953
  }
@@ -1144,20 +970,16 @@ var LanguageUtil = function () {
1144
970
  key: "toResolveHierarchy",
1145
971
  value: function toResolveHierarchy(code, fallbackCode) {
1146
972
  var _this2 = this;
1147
-
1148
973
  var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1149
974
  var codes = [];
1150
-
1151
975
  var addCode = function addCode(c) {
1152
976
  if (!c) return;
1153
-
1154
977
  if (_this2.isSupportedCode(c)) {
1155
978
  codes.push(c);
1156
979
  } else {
1157
980
  _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
1158
981
  }
1159
982
  };
1160
-
1161
983
  if (typeof code === 'string' && code.indexOf('-') > -1) {
1162
984
  if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
1163
985
  if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
@@ -1165,14 +987,12 @@ var LanguageUtil = function () {
1165
987
  } else if (typeof code === 'string') {
1166
988
  addCode(this.formatLanguageCode(code));
1167
989
  }
1168
-
1169
990
  fallbackCodes.forEach(function (fc) {
1170
991
  if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
1171
992
  });
1172
993
  return codes;
1173
994
  }
1174
995
  }]);
1175
-
1176
996
  return LanguageUtil;
1177
997
  }();
1178
998
 
@@ -1346,7 +1166,6 @@ var suffixesOrder = {
1346
1166
  many: 4,
1347
1167
  other: 5
1348
1168
  };
1349
-
1350
1169
  function createRules() {
1351
1170
  var rules = {};
1352
1171
  sets.forEach(function (set) {
@@ -1359,26 +1178,20 @@ function createRules() {
1359
1178
  });
1360
1179
  return rules;
1361
1180
  }
1362
-
1363
1181
  var PluralResolver = function () {
1364
1182
  function PluralResolver(languageUtils) {
1365
1183
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1366
-
1367
- _classCallCheck__default['default'](this, PluralResolver);
1368
-
1184
+ _classCallCheck__default["default"](this, PluralResolver);
1369
1185
  this.languageUtils = languageUtils;
1370
1186
  this.options = options;
1371
1187
  this.logger = baseLogger.create('pluralResolver');
1372
-
1373
1188
  if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
1374
1189
  this.options.compatibilityJSON = 'v3';
1375
1190
  this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');
1376
1191
  }
1377
-
1378
1192
  this.rules = createRules();
1379
1193
  }
1380
-
1381
- _createClass__default['default'](PluralResolver, [{
1194
+ _createClass__default["default"](PluralResolver, [{
1382
1195
  key: "addRule",
1383
1196
  value: function addRule(lng, obj) {
1384
1197
  this.rules[lng] = obj;
@@ -1387,7 +1200,6 @@ var PluralResolver = function () {
1387
1200
  key: "getRule",
1388
1201
  value: function getRule(code) {
1389
1202
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1390
-
1391
1203
  if (this.shouldUseIntlApi()) {
1392
1204
  try {
1393
1205
  return new Intl.PluralRules(code, {
@@ -1397,7 +1209,6 @@ var PluralResolver = function () {
1397
1209
  return;
1398
1210
  }
1399
1211
  }
1400
-
1401
1212
  return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
1402
1213
  }
1403
1214
  }, {
@@ -1405,11 +1216,9 @@ var PluralResolver = function () {
1405
1216
  value: function needsPlural(code) {
1406
1217
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1407
1218
  var rule = this.getRule(code, options);
1408
-
1409
1219
  if (this.shouldUseIntlApi()) {
1410
1220
  return rule && rule.resolvedOptions().pluralCategories.length > 1;
1411
1221
  }
1412
-
1413
1222
  return rule && rule.numbers.length > 1;
1414
1223
  }
1415
1224
  }, {
@@ -1424,14 +1233,11 @@ var PluralResolver = function () {
1424
1233
  key: "getSuffixes",
1425
1234
  value: function getSuffixes(code) {
1426
1235
  var _this = this;
1427
-
1428
1236
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1429
1237
  var rule = this.getRule(code, options);
1430
-
1431
1238
  if (!rule) {
1432
1239
  return [];
1433
1240
  }
1434
-
1435
1241
  if (this.shouldUseIntlApi()) {
1436
1242
  return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
1437
1243
  return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
@@ -1439,7 +1245,6 @@ var PluralResolver = function () {
1439
1245
  return "".concat(_this.options.prepend).concat(pluralCategory);
1440
1246
  });
1441
1247
  }
1442
-
1443
1248
  return rule.numbers.map(function (number) {
1444
1249
  return _this.getSuffix(code, number, options);
1445
1250
  });
@@ -1449,15 +1254,12 @@ var PluralResolver = function () {
1449
1254
  value: function getSuffix(code, count) {
1450
1255
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1451
1256
  var rule = this.getRule(code, options);
1452
-
1453
1257
  if (rule) {
1454
1258
  if (this.shouldUseIntlApi()) {
1455
1259
  return "".concat(this.options.prepend).concat(rule.select(count));
1456
1260
  }
1457
-
1458
1261
  return this.getSuffixRetroCompatible(rule, count);
1459
1262
  }
1460
-
1461
1263
  this.logger.warn("no plural rule found for: ".concat(code));
1462
1264
  return '';
1463
1265
  }
@@ -1465,10 +1267,8 @@ var PluralResolver = function () {
1465
1267
  key: "getSuffixRetroCompatible",
1466
1268
  value: function getSuffixRetroCompatible(rule, count) {
1467
1269
  var _this2 = this;
1468
-
1469
1270
  var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
1470
1271
  var suffix = rule.numbers[idx];
1471
-
1472
1272
  if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1473
1273
  if (suffix === 2) {
1474
1274
  suffix = 'plural';
@@ -1476,11 +1276,9 @@ var PluralResolver = function () {
1476
1276
  suffix = '';
1477
1277
  }
1478
1278
  }
1479
-
1480
1279
  var returnSuffix = function returnSuffix() {
1481
1280
  return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
1482
1281
  };
1483
-
1484
1282
  if (this.options.compatibilityJSON === 'v1') {
1485
1283
  if (suffix === 1) return '';
1486
1284
  if (typeof suffix === 'number') return "_plural_".concat(suffix.toString());
@@ -1490,7 +1288,6 @@ var PluralResolver = function () {
1490
1288
  } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1491
1289
  return returnSuffix();
1492
1290
  }
1493
-
1494
1291
  return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
1495
1292
  }
1496
1293
  }, {
@@ -1499,31 +1296,23 @@ var PluralResolver = function () {
1499
1296
  return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
1500
1297
  }
1501
1298
  }]);
1502
-
1503
1299
  return PluralResolver;
1504
1300
  }();
1505
1301
 
1506
- 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; }
1507
-
1508
- 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__default['default'](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; }
1509
-
1302
+ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1303
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1510
1304
  var Interpolator = function () {
1511
1305
  function Interpolator() {
1512
1306
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1513
-
1514
- _classCallCheck__default['default'](this, Interpolator);
1515
-
1307
+ _classCallCheck__default["default"](this, Interpolator);
1516
1308
  this.logger = baseLogger.create('interpolator');
1517
1309
  this.options = options;
1518
-
1519
1310
  this.format = options.interpolation && options.interpolation.format || function (value) {
1520
1311
  return value;
1521
1312
  };
1522
-
1523
1313
  this.init(options);
1524
1314
  }
1525
-
1526
- _createClass__default['default'](Interpolator, [{
1315
+ _createClass__default["default"](Interpolator, [{
1527
1316
  key: "init",
1528
1317
  value: function init() {
1529
1318
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -1565,16 +1354,13 @@ var Interpolator = function () {
1565
1354
  key: "interpolate",
1566
1355
  value: function interpolate(str, data, lng, options) {
1567
1356
  var _this = this;
1568
-
1569
1357
  var match;
1570
1358
  var value;
1571
1359
  var replaces;
1572
1360
  var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1573
-
1574
1361
  function regexSafe(val) {
1575
1362
  return val.replace(/\$/g, '$$$$');
1576
1363
  }
1577
-
1578
1364
  var handleFormat = function handleFormat(key) {
1579
1365
  if (key.indexOf(_this.formatSeparator) < 0) {
1580
1366
  var path = getPathWithDefaults(data, defaultData, key);
@@ -1582,7 +1368,6 @@ var Interpolator = function () {
1582
1368
  interpolationkey: key
1583
1369
  })) : path;
1584
1370
  }
1585
-
1586
1371
  var p = key.split(_this.formatSeparator);
1587
1372
  var k = p.shift().trim();
1588
1373
  var f = p.join(_this.formatSeparator).trim();
@@ -1590,7 +1375,6 @@ var Interpolator = function () {
1590
1375
  interpolationkey: k
1591
1376
  }));
1592
1377
  };
1593
-
1594
1378
  this.resetRegExp();
1595
1379
  var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
1596
1380
  var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
@@ -1607,11 +1391,9 @@ var Interpolator = function () {
1607
1391
  }];
1608
1392
  todos.forEach(function (todo) {
1609
1393
  replaces = 0;
1610
-
1611
1394
  while (match = todo.regex.exec(str)) {
1612
1395
  var matchedVar = match[1].trim();
1613
1396
  value = handleFormat(matchedVar);
1614
-
1615
1397
  if (value === undefined) {
1616
1398
  if (typeof missingInterpolationHandler === 'function') {
1617
1399
  var temp = missingInterpolationHandler(str, match, options);
@@ -1623,25 +1405,20 @@ var Interpolator = function () {
1623
1405
  continue;
1624
1406
  } else {
1625
1407
  _this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str));
1626
-
1627
1408
  value = '';
1628
1409
  }
1629
1410
  } else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
1630
1411
  value = makeString(value);
1631
1412
  }
1632
-
1633
1413
  var safeValue = todo.safeValue(value);
1634
1414
  str = str.replace(match[0], safeValue);
1635
-
1636
1415
  if (skipOnVariables) {
1637
1416
  todo.regex.lastIndex += value.length;
1638
1417
  todo.regex.lastIndex -= match[0].length;
1639
1418
  } else {
1640
1419
  todo.regex.lastIndex = 0;
1641
1420
  }
1642
-
1643
1421
  replaces++;
1644
-
1645
1422
  if (replaces >= _this.maxReplaces) {
1646
1423
  break;
1647
1424
  }
@@ -1653,16 +1430,10 @@ var Interpolator = function () {
1653
1430
  key: "nest",
1654
1431
  value: function nest(str, fc) {
1655
1432
  var _this2 = this;
1656
-
1657
1433
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1658
1434
  var match;
1659
1435
  var value;
1660
-
1661
- var clonedOptions = _objectSpread$3({}, options);
1662
-
1663
- clonedOptions.applyPostProcessor = false;
1664
- delete clonedOptions.defaultValue;
1665
-
1436
+ var clonedOptions;
1666
1437
  function handleHasOptions(key, inheritedOptions) {
1667
1438
  var sep = this.nestingOptionsSeparator;
1668
1439
  if (key.indexOf(sep) < 0) return key;
@@ -1672,11 +1443,9 @@ var Interpolator = function () {
1672
1443
  optionsString = this.interpolate(optionsString, clonedOptions);
1673
1444
  var matchedSingleQuotes = optionsString.match(/'/g);
1674
1445
  var matchedDoubleQuotes = optionsString.match(/"/g);
1675
-
1676
1446
  if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
1677
1447
  optionsString = optionsString.replace(/'/g, '"');
1678
1448
  }
1679
-
1680
1449
  try {
1681
1450
  clonedOptions = JSON.parse(optionsString);
1682
1451
  if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
@@ -1684,15 +1453,15 @@ var Interpolator = function () {
1684
1453
  this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
1685
1454
  return "".concat(key).concat(sep).concat(optionsString);
1686
1455
  }
1687
-
1688
1456
  delete clonedOptions.defaultValue;
1689
1457
  return key;
1690
1458
  }
1691
-
1692
1459
  while (match = this.nestingRegexp.exec(str)) {
1693
1460
  var formatters = [];
1461
+ clonedOptions = _objectSpread$3({}, options);
1462
+ clonedOptions.applyPostProcessor = false;
1463
+ delete clonedOptions.defaultValue;
1694
1464
  var doReduce = false;
1695
-
1696
1465
  if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
1697
1466
  var r = match[1].split(this.formatSeparator).map(function (elem) {
1698
1467
  return elem.trim();
@@ -1701,16 +1470,13 @@ var Interpolator = function () {
1701
1470
  formatters = r;
1702
1471
  doReduce = true;
1703
1472
  }
1704
-
1705
1473
  value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1706
1474
  if (value && match[0] === str && typeof value !== 'string') return value;
1707
1475
  if (typeof value !== 'string') value = makeString(value);
1708
-
1709
1476
  if (!value) {
1710
1477
  this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str));
1711
1478
  value = '';
1712
1479
  }
1713
-
1714
1480
  if (doReduce) {
1715
1481
  value = formatters.reduce(function (v, f) {
1716
1482
  return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
@@ -1718,31 +1484,24 @@ var Interpolator = function () {
1718
1484
  }));
1719
1485
  }, value.trim());
1720
1486
  }
1721
-
1722
1487
  str = str.replace(match[0], value);
1723
1488
  this.regexp.lastIndex = 0;
1724
1489
  }
1725
-
1726
1490
  return str;
1727
1491
  }
1728
1492
  }]);
1729
-
1730
1493
  return Interpolator;
1731
1494
  }();
1732
1495
 
1733
- 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; }
1734
-
1735
- 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__default['default'](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; }
1736
-
1496
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1497
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1737
1498
  function parseFormatStr(formatStr) {
1738
1499
  var formatName = formatStr.toLowerCase().trim();
1739
1500
  var formatOptions = {};
1740
-
1741
1501
  if (formatStr.indexOf('(') > -1) {
1742
1502
  var p = formatStr.split('(');
1743
1503
  formatName = p[0].toLowerCase().trim();
1744
1504
  var optStr = p[1].substring(0, p[1].length - 1);
1745
-
1746
1505
  if (formatName === 'currency' && optStr.indexOf(':') < 0) {
1747
1506
  if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1748
1507
  } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
@@ -1751,12 +1510,10 @@ function parseFormatStr(formatStr) {
1751
1510
  var opts = optStr.split(';');
1752
1511
  opts.forEach(function (opt) {
1753
1512
  if (!opt) return;
1754
-
1755
1513
  var _opt$split = opt.split(':'),
1756
- _opt$split2 = _toArray__default['default'](_opt$split),
1757
- key = _opt$split2[0],
1758
- rest = _opt$split2.slice(1);
1759
-
1514
+ _opt$split2 = _toArray__default["default"](_opt$split),
1515
+ key = _opt$split2[0],
1516
+ rest = _opt$split2.slice(1);
1760
1517
  var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
1761
1518
  if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
1762
1519
  if (val === 'false') formatOptions[key.trim()] = false;
@@ -1765,34 +1522,27 @@ function parseFormatStr(formatStr) {
1765
1522
  });
1766
1523
  }
1767
1524
  }
1768
-
1769
1525
  return {
1770
1526
  formatName: formatName,
1771
1527
  formatOptions: formatOptions
1772
1528
  };
1773
1529
  }
1774
-
1775
1530
  function createCachedFormatter(fn) {
1776
1531
  var cache = {};
1777
1532
  return function invokeFormatter(val, lng, options) {
1778
1533
  var key = lng + JSON.stringify(options);
1779
1534
  var formatter = cache[key];
1780
-
1781
1535
  if (!formatter) {
1782
1536
  formatter = fn(lng, options);
1783
1537
  cache[key] = formatter;
1784
1538
  }
1785
-
1786
1539
  return formatter(val);
1787
1540
  };
1788
1541
  }
1789
-
1790
1542
  var Formatter = function () {
1791
1543
  function Formatter() {
1792
1544
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1793
-
1794
- _classCallCheck__default['default'](this, Formatter);
1795
-
1545
+ _classCallCheck__default["default"](this, Formatter);
1796
1546
  this.logger = baseLogger.create('formatter');
1797
1547
  this.options = options;
1798
1548
  this.formats = {
@@ -1803,7 +1553,7 @@ var Formatter = function () {
1803
1553
  };
1804
1554
  }),
1805
1555
  currency: createCachedFormatter(function (lng, options) {
1806
- var formatter = new Intl.NumberFormat(lng, _objectSpread$4(_objectSpread$4({}, options), {}, {
1556
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, options), {}, {
1807
1557
  style: 'currency'
1808
1558
  }));
1809
1559
  return function (val) {
@@ -1811,19 +1561,19 @@ var Formatter = function () {
1811
1561
  };
1812
1562
  }),
1813
1563
  datetime: createCachedFormatter(function (lng, options) {
1814
- var formatter = new Intl.DateTimeFormat(lng, _objectSpread$4({}, options));
1564
+ var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, options));
1815
1565
  return function (val) {
1816
1566
  return formatter.format(val);
1817
1567
  };
1818
1568
  }),
1819
1569
  relativetime: createCachedFormatter(function (lng, options) {
1820
- var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$4({}, options));
1570
+ var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, options));
1821
1571
  return function (val) {
1822
1572
  return formatter.format(val, options.range || 'day');
1823
1573
  };
1824
1574
  }),
1825
1575
  list: createCachedFormatter(function (lng, options) {
1826
- var formatter = new Intl.ListFormat(lng, _objectSpread$4({}, options));
1576
+ var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, options));
1827
1577
  return function (val) {
1828
1578
  return formatter.format(val);
1829
1579
  };
@@ -1831,8 +1581,7 @@ var Formatter = function () {
1831
1581
  };
1832
1582
  this.init(options);
1833
1583
  }
1834
-
1835
- _createClass__default['default'](Formatter, [{
1584
+ _createClass__default["default"](Formatter, [{
1836
1585
  key: "init",
1837
1586
  value: function init(services) {
1838
1587
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
@@ -1855,72 +1604,53 @@ var Formatter = function () {
1855
1604
  key: "format",
1856
1605
  value: function format(value, _format, lng, options) {
1857
1606
  var _this = this;
1858
-
1859
1607
  var formats = _format.split(this.formatSeparator);
1860
-
1861
1608
  var result = formats.reduce(function (mem, f) {
1862
1609
  var _parseFormatStr = parseFormatStr(f),
1863
- formatName = _parseFormatStr.formatName,
1864
- formatOptions = _parseFormatStr.formatOptions;
1865
-
1610
+ formatName = _parseFormatStr.formatName,
1611
+ formatOptions = _parseFormatStr.formatOptions;
1866
1612
  if (_this.formats[formatName]) {
1867
1613
  var formatted = mem;
1868
-
1869
1614
  try {
1870
1615
  var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
1871
1616
  var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1872
- formatted = _this.formats[formatName](mem, l, _objectSpread$4(_objectSpread$4(_objectSpread$4({}, formatOptions), options), valOptions));
1617
+ formatted = _this.formats[formatName](mem, l, _objectSpread$2(_objectSpread$2(_objectSpread$2({}, formatOptions), options), valOptions));
1873
1618
  } catch (error) {
1874
1619
  _this.logger.warn(error);
1875
1620
  }
1876
-
1877
1621
  return formatted;
1878
1622
  } else {
1879
1623
  _this.logger.warn("there was no format function for ".concat(formatName));
1880
1624
  }
1881
-
1882
1625
  return mem;
1883
1626
  }, value);
1884
1627
  return result;
1885
1628
  }
1886
1629
  }]);
1887
-
1888
1630
  return Formatter;
1889
1631
  }();
1890
1632
 
1891
- 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; }
1892
-
1893
- 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__default['default'](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; }
1894
-
1895
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
1896
-
1897
- 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; } }
1898
-
1633
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1634
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1635
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
1636
+ 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; } }
1899
1637
  function removePending(q, name) {
1900
1638
  if (q.pending[name] !== undefined) {
1901
1639
  delete q.pending[name];
1902
1640
  q.pendingCount--;
1903
1641
  }
1904
1642
  }
1905
-
1906
1643
  var Connector = function (_EventEmitter) {
1907
- _inherits__default['default'](Connector, _EventEmitter);
1908
-
1909
- var _super = _createSuper$2(Connector);
1910
-
1644
+ _inherits__default["default"](Connector, _EventEmitter);
1645
+ var _super = _createSuper$1(Connector);
1911
1646
  function Connector(backend, store, services) {
1912
1647
  var _this;
1913
-
1914
1648
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1915
-
1916
- _classCallCheck__default['default'](this, Connector);
1917
-
1649
+ _classCallCheck__default["default"](this, Connector);
1918
1650
  _this = _super.call(this);
1919
-
1920
1651
  if (isIE10) {
1921
- EventEmitter.call(_assertThisInitialized__default['default'](_this));
1652
+ EventEmitter.call(_assertThisInitialized__default["default"](_this));
1922
1653
  }
1923
-
1924
1654
  _this.backend = backend;
1925
1655
  _this.store = store;
1926
1656
  _this.services = services;
@@ -1934,19 +1664,15 @@ var Connector = function (_EventEmitter) {
1934
1664
  _this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1935
1665
  _this.state = {};
1936
1666
  _this.queue = [];
1937
-
1938
1667
  if (_this.backend && _this.backend.init) {
1939
1668
  _this.backend.init(services, options.backend, options);
1940
1669
  }
1941
-
1942
1670
  return _this;
1943
1671
  }
1944
-
1945
- _createClass__default['default'](Connector, [{
1672
+ _createClass__default["default"](Connector, [{
1946
1673
  key: "queueLoad",
1947
1674
  value: function queueLoad(languages, namespaces, options, callback) {
1948
1675
  var _this2 = this;
1949
-
1950
1676
  var toLoad = {};
1951
1677
  var pending = {};
1952
1678
  var toLoadLanguages = {};
@@ -1955,7 +1681,6 @@ var Connector = function (_EventEmitter) {
1955
1681
  var hasAllNamespaces = true;
1956
1682
  namespaces.forEach(function (ns) {
1957
1683
  var name = "".concat(lng, "|").concat(ns);
1958
-
1959
1684
  if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
1960
1685
  _this2.state[name] = 2;
1961
1686
  } else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
@@ -1970,7 +1695,6 @@ var Connector = function (_EventEmitter) {
1970
1695
  });
1971
1696
  if (!hasAllNamespaces) toLoadLanguages[lng] = true;
1972
1697
  });
1973
-
1974
1698
  if (Object.keys(toLoad).length || Object.keys(pending).length) {
1975
1699
  this.queue.push({
1976
1700
  pending: pending,
@@ -1980,7 +1704,6 @@ var Connector = function (_EventEmitter) {
1980
1704
  callback: callback
1981
1705
  });
1982
1706
  }
1983
-
1984
1707
  return {
1985
1708
  toLoad: Object.keys(toLoad),
1986
1709
  pending: Object.keys(pending),
@@ -1995,23 +1718,19 @@ var Connector = function (_EventEmitter) {
1995
1718
  var lng = s[0];
1996
1719
  var ns = s[1];
1997
1720
  if (err) this.emit('failedLoading', lng, ns, err);
1998
-
1999
1721
  if (data) {
2000
1722
  this.store.addResourceBundle(lng, ns, data);
2001
1723
  }
2002
-
2003
1724
  this.state[name] = err ? -1 : 2;
2004
1725
  var loaded = {};
2005
1726
  this.queue.forEach(function (q) {
2006
1727
  pushPath(q.loaded, [lng], ns);
2007
1728
  removePending(q, name);
2008
1729
  if (err) q.errors.push(err);
2009
-
2010
1730
  if (q.pendingCount === 0 && !q.done) {
2011
1731
  Object.keys(q.loaded).forEach(function (l) {
2012
1732
  if (!loaded[l]) loaded[l] = {};
2013
1733
  var loadedKeys = q.loaded[l];
2014
-
2015
1734
  if (loadedKeys.length) {
2016
1735
  loadedKeys.forEach(function (ns) {
2017
1736
  if (loaded[l][ns] === undefined) loaded[l][ns] = true;
@@ -2019,7 +1738,6 @@ var Connector = function (_EventEmitter) {
2019
1738
  }
2020
1739
  });
2021
1740
  q.done = true;
2022
-
2023
1741
  if (q.errors.length) {
2024
1742
  q.callback(q.errors);
2025
1743
  } else {
@@ -2036,12 +1754,10 @@ var Connector = function (_EventEmitter) {
2036
1754
  key: "read",
2037
1755
  value: function read(lng, ns, fcName) {
2038
1756
  var _this3 = this;
2039
-
2040
1757
  var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2041
1758
  var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
2042
1759
  var callback = arguments.length > 5 ? arguments[5] : undefined;
2043
1760
  if (!lng.length) return callback(null, {});
2044
-
2045
1761
  if (this.readingCalls >= this.maxParallelReads) {
2046
1762
  this.waitingReads.push({
2047
1763
  lng: lng,
@@ -2053,49 +1769,56 @@ var Connector = function (_EventEmitter) {
2053
1769
  });
2054
1770
  return;
2055
1771
  }
2056
-
2057
1772
  this.readingCalls++;
2058
- return this.backend[fcName](lng, ns, function (err, data) {
1773
+ var resolver = function resolver(err, data) {
2059
1774
  _this3.readingCalls--;
2060
-
2061
1775
  if (_this3.waitingReads.length > 0) {
2062
1776
  var next = _this3.waitingReads.shift();
2063
-
2064
1777
  _this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
2065
1778
  }
2066
-
2067
1779
  if (err && data && tried < _this3.maxRetries) {
2068
1780
  setTimeout(function () {
2069
1781
  _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
2070
1782
  }, wait);
2071
1783
  return;
2072
1784
  }
2073
-
2074
1785
  callback(err, data);
2075
- });
1786
+ };
1787
+ var fc = this.backend[fcName].bind(this.backend);
1788
+ if (fc.length === 2) {
1789
+ try {
1790
+ var r = fc(lng, ns);
1791
+ if (r && typeof r.then === 'function') {
1792
+ r.then(function (data) {
1793
+ return resolver(null, data);
1794
+ })["catch"](resolver);
1795
+ } else {
1796
+ resolver(null, r);
1797
+ }
1798
+ } catch (err) {
1799
+ resolver(err);
1800
+ }
1801
+ return;
1802
+ }
1803
+ return fc(lng, ns, resolver);
2076
1804
  }
2077
1805
  }, {
2078
1806
  key: "prepareLoading",
2079
1807
  value: function prepareLoading(languages, namespaces) {
2080
1808
  var _this4 = this;
2081
-
2082
1809
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2083
1810
  var callback = arguments.length > 3 ? arguments[3] : undefined;
2084
-
2085
1811
  if (!this.backend) {
2086
1812
  this.logger.warn('No backend was added via i18next.use. Will not load resources.');
2087
1813
  return callback && callback();
2088
1814
  }
2089
-
2090
1815
  if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
2091
1816
  if (typeof namespaces === 'string') namespaces = [namespaces];
2092
1817
  var toLoad = this.queueLoad(languages, namespaces, options, callback);
2093
-
2094
1818
  if (!toLoad.toLoad.length) {
2095
1819
  if (!toLoad.pending.length) callback();
2096
1820
  return null;
2097
1821
  }
2098
-
2099
1822
  toLoad.toLoad.forEach(function (name) {
2100
1823
  _this4.loadOne(name);
2101
1824
  });
@@ -2116,7 +1839,6 @@ var Connector = function (_EventEmitter) {
2116
1839
  key: "loadOne",
2117
1840
  value: function loadOne(name) {
2118
1841
  var _this5 = this;
2119
-
2120
1842
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2121
1843
  var s = name.split('|');
2122
1844
  var lng = s[0];
@@ -2124,7 +1846,6 @@ var Connector = function (_EventEmitter) {
2124
1846
  this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
2125
1847
  if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
2126
1848
  if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
2127
-
2128
1849
  _this5.loaded(name, err, data);
2129
1850
  });
2130
1851
  }
@@ -2132,25 +1853,43 @@ var Connector = function (_EventEmitter) {
2132
1853
  key: "saveMissing",
2133
1854
  value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
2134
1855
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2135
-
1856
+ var clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
2136
1857
  if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
2137
1858
  this.logger.warn("did not save key \"".concat(key, "\" as the namespace \"").concat(namespace, "\" 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!!!');
2138
1859
  return;
2139
1860
  }
2140
-
2141
1861
  if (key === undefined || key === null || key === '') return;
2142
-
2143
1862
  if (this.backend && this.backend.create) {
2144
- this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5(_objectSpread$5({}, options), {}, {
1863
+ var opts = _objectSpread$1(_objectSpread$1({}, options), {}, {
2145
1864
  isUpdate: isUpdate
2146
- }));
1865
+ });
1866
+ var fc = this.backend.create.bind(this.backend);
1867
+ if (fc.length < 6) {
1868
+ try {
1869
+ var r;
1870
+ if (fc.length === 5) {
1871
+ r = fc(languages, namespace, key, fallbackValue, opts);
1872
+ } else {
1873
+ r = fc(languages, namespace, key, fallbackValue);
1874
+ }
1875
+ if (r && typeof r.then === 'function') {
1876
+ r.then(function (data) {
1877
+ return clb(null, data);
1878
+ })["catch"](clb);
1879
+ } else {
1880
+ clb(null, r);
1881
+ }
1882
+ } catch (err) {
1883
+ clb(err);
1884
+ }
1885
+ } else {
1886
+ fc(languages, namespace, key, fallbackValue, clb, opts);
1887
+ }
2147
1888
  }
2148
-
2149
1889
  if (!languages || !languages[0]) return;
2150
1890
  this.store.addResource(languages[0], namespace, key, fallbackValue);
2151
1891
  }
2152
1892
  }]);
2153
-
2154
1893
  return Connector;
2155
1894
  }(EventEmitter);
2156
1895
 
@@ -2190,17 +1929,15 @@ function get() {
2190
1929
  appendNamespaceToCIMode: false,
2191
1930
  overloadTranslationOptionHandler: function handle(args) {
2192
1931
  var ret = {};
2193
- if (_typeof__default['default'](args[1]) === 'object') ret = args[1];
1932
+ if (_typeof__default["default"](args[1]) === 'object') ret = args[1];
2194
1933
  if (typeof args[1] === 'string') ret.defaultValue = args[1];
2195
1934
  if (typeof args[2] === 'string') ret.tDescription = args[2];
2196
-
2197
- if (_typeof__default['default'](args[2]) === 'object' || _typeof__default['default'](args[3]) === 'object') {
1935
+ if (_typeof__default["default"](args[2]) === 'object' || _typeof__default["default"](args[3]) === 'object') {
2198
1936
  var options = args[3] || args[2];
2199
1937
  Object.keys(options).forEach(function (key) {
2200
1938
  ret[key] = options[key];
2201
1939
  });
2202
1940
  }
2203
-
2204
1941
  return ret;
2205
1942
  },
2206
1943
  interpolation: {
@@ -2224,24 +1961,17 @@ function transformOptions(options) {
2224
1961
  if (typeof options.ns === 'string') options.ns = [options.ns];
2225
1962
  if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
2226
1963
  if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
2227
-
2228
1964
  if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
2229
1965
  options.supportedLngs = options.supportedLngs.concat(['cimode']);
2230
1966
  }
2231
-
2232
1967
  return options;
2233
1968
  }
2234
1969
 
2235
- 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; }
2236
-
2237
- 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__default['default'](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; }
2238
-
2239
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
2240
-
2241
- 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; } }
2242
-
1970
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1971
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1972
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
1973
+ 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; } }
2243
1974
  function noop() {}
2244
-
2245
1975
  function bindMemberFunctions(inst) {
2246
1976
  var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
2247
1977
  mems.forEach(function (mem) {
@@ -2250,62 +1980,46 @@ function bindMemberFunctions(inst) {
2250
1980
  }
2251
1981
  });
2252
1982
  }
2253
-
2254
1983
  var I18n = function (_EventEmitter) {
2255
- _inherits__default['default'](I18n, _EventEmitter);
2256
-
2257
- var _super = _createSuper$3(I18n);
2258
-
1984
+ _inherits__default["default"](I18n, _EventEmitter);
1985
+ var _super = _createSuper(I18n);
2259
1986
  function I18n() {
2260
1987
  var _this;
2261
-
2262
1988
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2263
1989
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2264
-
2265
- _classCallCheck__default['default'](this, I18n);
2266
-
1990
+ _classCallCheck__default["default"](this, I18n);
2267
1991
  _this = _super.call(this);
2268
-
2269
1992
  if (isIE10) {
2270
- EventEmitter.call(_assertThisInitialized__default['default'](_this));
1993
+ EventEmitter.call(_assertThisInitialized__default["default"](_this));
2271
1994
  }
2272
-
2273
1995
  _this.options = transformOptions(options);
2274
1996
  _this.services = {};
2275
1997
  _this.logger = baseLogger;
2276
1998
  _this.modules = {
2277
1999
  external: []
2278
2000
  };
2279
- bindMemberFunctions(_assertThisInitialized__default['default'](_this));
2280
-
2001
+ bindMemberFunctions(_assertThisInitialized__default["default"](_this));
2281
2002
  if (callback && !_this.isInitialized && !options.isClone) {
2282
2003
  if (!_this.options.initImmediate) {
2283
2004
  _this.init(options, callback);
2284
-
2285
- return _possibleConstructorReturn__default['default'](_this, _assertThisInitialized__default['default'](_this));
2005
+ return _possibleConstructorReturn__default["default"](_this, _assertThisInitialized__default["default"](_this));
2286
2006
  }
2287
-
2288
2007
  setTimeout(function () {
2289
2008
  _this.init(options, callback);
2290
2009
  }, 0);
2291
2010
  }
2292
-
2293
2011
  return _this;
2294
2012
  }
2295
-
2296
- _createClass__default['default'](I18n, [{
2013
+ _createClass__default["default"](I18n, [{
2297
2014
  key: "init",
2298
2015
  value: function init() {
2299
2016
  var _this2 = this;
2300
-
2301
2017
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2302
2018
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2303
-
2304
2019
  if (typeof options === 'function') {
2305
2020
  callback = options;
2306
2021
  options = {};
2307
2022
  }
2308
-
2309
2023
  if (!options.defaultNS && options.defaultNS !== false && options.ns) {
2310
2024
  if (typeof options.ns === 'string') {
2311
2025
  options.defaultNS = options.ns;
@@ -2313,43 +2027,34 @@ var I18n = function (_EventEmitter) {
2313
2027
  options.defaultNS = options.ns[0];
2314
2028
  }
2315
2029
  }
2316
-
2317
2030
  var defOpts = get();
2318
- this.options = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, defOpts), this.options), transformOptions(options));
2319
-
2031
+ this.options = _objectSpread(_objectSpread(_objectSpread({}, defOpts), this.options), transformOptions(options));
2320
2032
  if (this.options.compatibilityAPI !== 'v1') {
2321
- this.options.interpolation = _objectSpread$6(_objectSpread$6({}, defOpts.interpolation), this.options.interpolation);
2033
+ this.options.interpolation = _objectSpread(_objectSpread({}, defOpts.interpolation), this.options.interpolation);
2322
2034
  }
2323
-
2324
2035
  if (options.keySeparator !== undefined) {
2325
2036
  this.options.userDefinedKeySeparator = options.keySeparator;
2326
2037
  }
2327
-
2328
2038
  if (options.nsSeparator !== undefined) {
2329
2039
  this.options.userDefinedNsSeparator = options.nsSeparator;
2330
2040
  }
2331
-
2332
2041
  function createClassOnDemand(ClassOrObject) {
2333
2042
  if (!ClassOrObject) return null;
2334
2043
  if (typeof ClassOrObject === 'function') return new ClassOrObject();
2335
2044
  return ClassOrObject;
2336
2045
  }
2337
-
2338
2046
  if (!this.options.isClone) {
2339
2047
  if (this.modules.logger) {
2340
2048
  baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
2341
2049
  } else {
2342
2050
  baseLogger.init(null, this.options);
2343
2051
  }
2344
-
2345
2052
  var formatter;
2346
-
2347
2053
  if (this.modules.formatter) {
2348
2054
  formatter = this.modules.formatter;
2349
2055
  } else if (typeof Intl !== 'undefined') {
2350
2056
  formatter = Formatter;
2351
2057
  }
2352
-
2353
2058
  var lu = new LanguageUtil(this.options);
2354
2059
  this.store = new ResourceStore(this.options.resources, this.options);
2355
2060
  var s = this.services;
@@ -2361,13 +2066,11 @@ var I18n = function (_EventEmitter) {
2361
2066
  compatibilityJSON: this.options.compatibilityJSON,
2362
2067
  simplifyPluralSuffix: this.options.simplifyPluralSuffix
2363
2068
  });
2364
-
2365
2069
  if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
2366
2070
  s.formatter = createClassOnDemand(formatter);
2367
2071
  s.formatter.init(s, this.options);
2368
2072
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
2369
2073
  }
2370
-
2371
2074
  s.interpolator = new Interpolator(this.options);
2372
2075
  s.utils = {
2373
2076
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
@@ -2377,50 +2080,40 @@ var I18n = function (_EventEmitter) {
2377
2080
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2378
2081
  args[_key - 1] = arguments[_key];
2379
2082
  }
2380
-
2381
2083
  _this2.emit.apply(_this2, [event].concat(args));
2382
2084
  });
2383
-
2384
2085
  if (this.modules.languageDetector) {
2385
2086
  s.languageDetector = createClassOnDemand(this.modules.languageDetector);
2386
2087
  s.languageDetector.init(s, this.options.detection, this.options);
2387
2088
  }
2388
-
2389
2089
  if (this.modules.i18nFormat) {
2390
2090
  s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2391
2091
  if (s.i18nFormat.init) s.i18nFormat.init(this);
2392
2092
  }
2393
-
2394
2093
  this.translator = new Translator(this.services, this.options);
2395
2094
  this.translator.on('*', function (event) {
2396
2095
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2397
2096
  args[_key2 - 1] = arguments[_key2];
2398
2097
  }
2399
-
2400
2098
  _this2.emit.apply(_this2, [event].concat(args));
2401
2099
  });
2402
2100
  this.modules.external.forEach(function (m) {
2403
2101
  if (m.init) m.init(_this2);
2404
2102
  });
2405
2103
  }
2406
-
2407
2104
  this.format = this.options.interpolation.format;
2408
2105
  if (!callback) callback = noop;
2409
-
2410
2106
  if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
2411
2107
  var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2412
2108
  if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
2413
2109
  }
2414
-
2415
2110
  if (!this.services.languageDetector && !this.options.lng) {
2416
2111
  this.logger.warn('init: no languageDetector is used and no lng is defined');
2417
2112
  }
2418
-
2419
2113
  var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
2420
2114
  storeApi.forEach(function (fcName) {
2421
2115
  _this2[fcName] = function () {
2422
2116
  var _this2$store;
2423
-
2424
2117
  return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
2425
2118
  };
2426
2119
  });
@@ -2428,63 +2121,48 @@ var I18n = function (_EventEmitter) {
2428
2121
  storeApiChained.forEach(function (fcName) {
2429
2122
  _this2[fcName] = function () {
2430
2123
  var _this2$store2;
2431
-
2432
2124
  (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
2433
-
2434
2125
  return _this2;
2435
2126
  };
2436
2127
  });
2437
2128
  var deferred = defer();
2438
-
2439
2129
  var load = function load() {
2440
2130
  var finish = function finish(err, t) {
2441
2131
  if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
2442
2132
  _this2.isInitialized = true;
2443
2133
  if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
2444
-
2445
2134
  _this2.emit('initialized', _this2.options);
2446
-
2447
2135
  deferred.resolve(t);
2448
2136
  callback(err, t);
2449
2137
  };
2450
-
2451
2138
  if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
2452
-
2453
2139
  _this2.changeLanguage(_this2.options.lng, finish);
2454
2140
  };
2455
-
2456
2141
  if (this.options.resources || !this.options.initImmediate) {
2457
2142
  load();
2458
2143
  } else {
2459
2144
  setTimeout(load, 0);
2460
2145
  }
2461
-
2462
2146
  return deferred;
2463
2147
  }
2464
2148
  }, {
2465
2149
  key: "loadResources",
2466
2150
  value: function loadResources(language) {
2467
2151
  var _this3 = this;
2468
-
2469
2152
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
2470
2153
  var usedCallback = callback;
2471
2154
  var usedLng = typeof language === 'string' ? language : this.language;
2472
2155
  if (typeof language === 'function') usedCallback = language;
2473
-
2474
2156
  if (!this.options.resources || this.options.partialBundledLanguages) {
2475
2157
  if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
2476
2158
  var toLoad = [];
2477
-
2478
2159
  var append = function append(lng) {
2479
2160
  if (!lng) return;
2480
-
2481
2161
  var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
2482
-
2483
2162
  lngs.forEach(function (l) {
2484
2163
  if (toLoad.indexOf(l) < 0) toLoad.push(l);
2485
2164
  });
2486
2165
  };
2487
-
2488
2166
  if (!usedLng) {
2489
2167
  var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2490
2168
  fallbacks.forEach(function (l) {
@@ -2493,13 +2171,11 @@ var I18n = function (_EventEmitter) {
2493
2171
  } else {
2494
2172
  append(usedLng);
2495
2173
  }
2496
-
2497
2174
  if (this.options.preload) {
2498
2175
  this.options.preload.forEach(function (l) {
2499
2176
  return append(l);
2500
2177
  });
2501
2178
  }
2502
-
2503
2179
  this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
2504
2180
  if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
2505
2181
  usedCallback(e);
@@ -2526,35 +2202,27 @@ var I18n = function (_EventEmitter) {
2526
2202
  value: function use(module) {
2527
2203
  if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
2528
2204
  if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
2529
-
2530
2205
  if (module.type === 'backend') {
2531
2206
  this.modules.backend = module;
2532
2207
  }
2533
-
2534
2208
  if (module.type === 'logger' || module.log && module.warn && module.error) {
2535
2209
  this.modules.logger = module;
2536
2210
  }
2537
-
2538
2211
  if (module.type === 'languageDetector') {
2539
2212
  this.modules.languageDetector = module;
2540
2213
  }
2541
-
2542
2214
  if (module.type === 'i18nFormat') {
2543
2215
  this.modules.i18nFormat = module;
2544
2216
  }
2545
-
2546
2217
  if (module.type === 'postProcessor') {
2547
2218
  postProcessor.addPostProcessor(module);
2548
2219
  }
2549
-
2550
2220
  if (module.type === 'formatter') {
2551
2221
  this.modules.formatter = module;
2552
2222
  }
2553
-
2554
2223
  if (module.type === '3rdParty') {
2555
2224
  this.modules.external.push(module);
2556
2225
  }
2557
-
2558
2226
  return this;
2559
2227
  }
2560
2228
  }, {
@@ -2562,11 +2230,9 @@ var I18n = function (_EventEmitter) {
2562
2230
  value: function setResolvedLanguage(l) {
2563
2231
  if (!l || !this.languages) return;
2564
2232
  if (['cimode', 'dev'].indexOf(l) > -1) return;
2565
-
2566
2233
  for (var li = 0; li < this.languages.length; li++) {
2567
2234
  var lngInLngs = this.languages[li];
2568
2235
  if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
2569
-
2570
2236
  if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
2571
2237
  this.resolvedLanguage = lngInLngs;
2572
2238
  break;
@@ -2577,34 +2243,25 @@ var I18n = function (_EventEmitter) {
2577
2243
  key: "changeLanguage",
2578
2244
  value: function changeLanguage(lng, callback) {
2579
2245
  var _this4 = this;
2580
-
2581
2246
  this.isLanguageChangingTo = lng;
2582
2247
  var deferred = defer();
2583
2248
  this.emit('languageChanging', lng);
2584
-
2585
2249
  var setLngProps = function setLngProps(l) {
2586
2250
  _this4.language = l;
2587
2251
  _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
2588
2252
  _this4.resolvedLanguage = undefined;
2589
-
2590
2253
  _this4.setResolvedLanguage(l);
2591
2254
  };
2592
-
2593
2255
  var done = function done(err, l) {
2594
2256
  if (l) {
2595
2257
  setLngProps(l);
2596
-
2597
2258
  _this4.translator.changeLanguage(l);
2598
-
2599
2259
  _this4.isLanguageChangingTo = undefined;
2600
-
2601
2260
  _this4.emit('languageChanged', l);
2602
-
2603
2261
  _this4.logger.log('languageChanged', l);
2604
2262
  } else {
2605
2263
  _this4.isLanguageChangingTo = undefined;
2606
2264
  }
2607
-
2608
2265
  deferred.resolve(function () {
2609
2266
  return _this4.t.apply(_this4, arguments);
2610
2267
  });
@@ -2612,25 +2269,20 @@ var I18n = function (_EventEmitter) {
2612
2269
  return _this4.t.apply(_this4, arguments);
2613
2270
  });
2614
2271
  };
2615
-
2616
2272
  var setLng = function setLng(lngs) {
2617
2273
  if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
2618
2274
  var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
2619
-
2620
2275
  if (l) {
2621
2276
  if (!_this4.language) {
2622
2277
  setLngProps(l);
2623
2278
  }
2624
-
2625
2279
  if (!_this4.translator.language) _this4.translator.changeLanguage(l);
2626
2280
  if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l);
2627
2281
  }
2628
-
2629
2282
  _this4.loadResources(l, function (err) {
2630
2283
  done(err, l);
2631
2284
  });
2632
2285
  };
2633
-
2634
2286
  if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
2635
2287
  setLng(this.services.languageDetector.detect());
2636
2288
  } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
@@ -2638,27 +2290,22 @@ var I18n = function (_EventEmitter) {
2638
2290
  } else {
2639
2291
  setLng(lng);
2640
2292
  }
2641
-
2642
2293
  return deferred;
2643
2294
  }
2644
2295
  }, {
2645
2296
  key: "getFixedT",
2646
2297
  value: function getFixedT(lng, ns, keyPrefix) {
2647
2298
  var _this5 = this;
2648
-
2649
2299
  var fixedT = function fixedT(key, opts) {
2650
2300
  var options;
2651
-
2652
- if (_typeof__default['default'](opts) !== 'object') {
2301
+ if (_typeof__default["default"](opts) !== 'object') {
2653
2302
  for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2654
2303
  rest[_key3 - 2] = arguments[_key3];
2655
2304
  }
2656
-
2657
2305
  options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
2658
2306
  } else {
2659
- options = _objectSpread$6({}, opts);
2307
+ options = _objectSpread({}, opts);
2660
2308
  }
2661
-
2662
2309
  options.lng = options.lng || fixedT.lng;
2663
2310
  options.lngs = options.lngs || fixedT.lngs;
2664
2311
  options.ns = options.ns || fixedT.ns;
@@ -2667,13 +2314,11 @@ var I18n = function (_EventEmitter) {
2667
2314
  var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2668
2315
  return _this5.t(resultKey, options);
2669
2316
  };
2670
-
2671
2317
  if (typeof lng === 'string') {
2672
2318
  fixedT.lng = lng;
2673
2319
  } else {
2674
2320
  fixedT.lngs = lng;
2675
2321
  }
2676
-
2677
2322
  fixedT.ns = ns;
2678
2323
  fixedT.keyPrefix = keyPrefix;
2679
2324
  return fixedT;
@@ -2682,14 +2327,12 @@ var I18n = function (_EventEmitter) {
2682
2327
  key: "t",
2683
2328
  value: function t() {
2684
2329
  var _this$translator;
2685
-
2686
2330
  return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
2687
2331
  }
2688
2332
  }, {
2689
2333
  key: "exists",
2690
2334
  value: function exists() {
2691
2335
  var _this$translator2;
2692
-
2693
2336
  return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
2694
2337
  }
2695
2338
  }, {
@@ -2701,35 +2344,27 @@ var I18n = function (_EventEmitter) {
2701
2344
  key: "hasLoadedNamespace",
2702
2345
  value: function hasLoadedNamespace(ns) {
2703
2346
  var _this6 = this;
2704
-
2705
2347
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2706
-
2707
2348
  if (!this.isInitialized) {
2708
2349
  this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
2709
2350
  return false;
2710
2351
  }
2711
-
2712
2352
  if (!this.languages || !this.languages.length) {
2713
2353
  this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
2714
2354
  return false;
2715
2355
  }
2716
-
2717
2356
  var lng = this.resolvedLanguage || this.languages[0];
2718
2357
  var fallbackLng = this.options ? this.options.fallbackLng : false;
2719
2358
  var lastLng = this.languages[this.languages.length - 1];
2720
2359
  if (lng.toLowerCase() === 'cimode') return true;
2721
-
2722
2360
  var loadNotPending = function loadNotPending(l, n) {
2723
2361
  var loadState = _this6.services.backendConnector.state["".concat(l, "|").concat(n)];
2724
-
2725
2362
  return loadState === -1 || loadState === 2;
2726
2363
  };
2727
-
2728
2364
  if (options.precheck) {
2729
2365
  var preResult = options.precheck(this, loadNotPending);
2730
2366
  if (preResult !== undefined) return preResult;
2731
2367
  }
2732
-
2733
2368
  if (this.hasResourceBundle(lng, ns)) return true;
2734
2369
  if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
2735
2370
  if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
@@ -2739,14 +2374,11 @@ var I18n = function (_EventEmitter) {
2739
2374
  key: "loadNamespaces",
2740
2375
  value: function loadNamespaces(ns, callback) {
2741
2376
  var _this7 = this;
2742
-
2743
2377
  var deferred = defer();
2744
-
2745
2378
  if (!this.options.ns) {
2746
2379
  callback && callback();
2747
2380
  return Promise.resolve();
2748
2381
  }
2749
-
2750
2382
  if (typeof ns === 'string') ns = [ns];
2751
2383
  ns.forEach(function (n) {
2752
2384
  if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
@@ -2766,12 +2398,10 @@ var I18n = function (_EventEmitter) {
2766
2398
  var newLngs = lngs.filter(function (lng) {
2767
2399
  return preloaded.indexOf(lng) < 0;
2768
2400
  });
2769
-
2770
2401
  if (!newLngs.length) {
2771
2402
  if (callback) callback();
2772
2403
  return Promise.resolve();
2773
2404
  }
2774
-
2775
2405
  this.options.preload = preloaded.concat(newLngs);
2776
2406
  this.loadResources(function (err) {
2777
2407
  deferred.resolve();
@@ -2791,25 +2421,20 @@ var I18n = function (_EventEmitter) {
2791
2421
  key: "cloneInstance",
2792
2422
  value: function cloneInstance() {
2793
2423
  var _this8 = this;
2794
-
2795
2424
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2796
2425
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
2797
-
2798
- var mergedOptions = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, this.options), options), {
2426
+ var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, this.options), options), {
2799
2427
  isClone: true
2800
2428
  });
2801
-
2802
2429
  var clone = new I18n(mergedOptions);
2803
-
2804
2430
  if (options.debug !== undefined || options.prefix !== undefined) {
2805
2431
  clone.logger = clone.logger.clone(options);
2806
2432
  }
2807
-
2808
2433
  var membersToCopy = ['store', 'services', 'language'];
2809
2434
  membersToCopy.forEach(function (m) {
2810
2435
  clone[m] = _this8[m];
2811
2436
  });
2812
- clone.services = _objectSpread$6({}, this.services);
2437
+ clone.services = _objectSpread({}, this.services);
2813
2438
  clone.services.utils = {
2814
2439
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2815
2440
  };
@@ -2818,7 +2443,6 @@ var I18n = function (_EventEmitter) {
2818
2443
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
2819
2444
  args[_key4 - 1] = arguments[_key4];
2820
2445
  }
2821
-
2822
2446
  clone.emit.apply(clone, [event].concat(args));
2823
2447
  });
2824
2448
  clone.init(mergedOptions, callback);
@@ -2840,16 +2464,13 @@ var I18n = function (_EventEmitter) {
2840
2464
  };
2841
2465
  }
2842
2466
  }]);
2843
-
2844
2467
  return I18n;
2845
2468
  }(EventEmitter);
2846
-
2847
- _defineProperty__default['default'](I18n, "createInstance", function () {
2469
+ _defineProperty__default["default"](I18n, "createInstance", function () {
2848
2470
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2849
2471
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2850
2472
  return new I18n(options, callback);
2851
2473
  });
2852
-
2853
2474
  var instance = I18n.createInstance();
2854
2475
  instance.createInstance = I18n.createInstance;
2855
2476