@formatjs/intl-pluralrules 5.2.5 → 5.2.6

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/polyfill.iife.js +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-pluralrules",
3
- "version": "5.2.5",
3
+ "version": "5.2.6",
4
4
  "description": "Polyfill for Intl.PluralRules",
5
5
  "keywords": [
6
6
  "polyfill",
@@ -20,13 +20,13 @@
20
20
  "url": "git+https://github.com/formatjs/formatjs.git"
21
21
  },
22
22
  "dependencies": {
23
- "@formatjs/ecma402-abstract": "1.17.1",
24
- "@formatjs/intl-localematcher": "0.4.1",
23
+ "@formatjs/ecma402-abstract": "1.17.2",
24
+ "@formatjs/intl-localematcher": "0.4.2",
25
25
  "tslib": "^2.4.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@formatjs/intl-getcanonicallocales": "2.2.1",
29
- "@formatjs/intl-locale": "3.3.3"
29
+ "@formatjs/intl-locale": "3.3.4"
30
30
  },
31
31
  "bugs": {
32
32
  "url": "https://github.com/formatjs/formatjs/issues"
package/polyfill.iife.js CHANGED
@@ -419,7 +419,7 @@
419
419
  if (availableLocale) {
420
420
  result.locale = availableLocale;
421
421
  if (locale !== noExtensionLocale) {
422
- result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
422
+ result.extension = locale.slice(noExtensionLocale.length, locale.length);
423
423
  }
424
424
  return result;
425
425
  }
@@ -445,12 +445,16 @@
445
445
  minimizedAvailableLocales.add(canonicalizedLocale);
446
446
  });
447
447
  var foundLocale;
448
+ var extension;
448
449
  for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
449
450
  var l = requestedLocales_1[_i];
450
451
  if (foundLocale) {
451
452
  break;
452
453
  }
453
454
  var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
455
+ if (l !== noExtensionLocale) {
456
+ extension = l.slice(noExtensionLocale.length, l.length);
457
+ }
454
458
  if (availableLocales.has(noExtensionLocale)) {
455
459
  foundLocale = noExtensionLocale;
456
460
  break;
@@ -472,7 +476,8 @@
472
476
  return { locale: getDefaultLocale() };
473
477
  }
474
478
  return {
475
- locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale
479
+ locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale,
480
+ extension
476
481
  };
477
482
  }
478
483