@formatjs/intl-pluralrules 4.1.6 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/should-polyfill.d.ts +1 -1
- package/lib/should-polyfill.d.ts.map +1 -1
- package/lib/should-polyfill.js +7 -2
- package/lib/supported-locales.d.ts +2 -0
- package/lib/supported-locales.d.ts.map +1 -0
- package/lib/supported-locales.js +2 -0
- package/package.json +1 -1
- package/polyfill.iife.js +14 -3
- package/should-polyfill.d.ts +1 -1
- package/should-polyfill.d.ts.map +1 -1
- package/should-polyfill.js +7 -2
- package/supported-locales.d.ts +2 -0
- package/supported-locales.d.ts.map +1 -0
- package/supported-locales.js +5 -0
package/lib/should-polyfill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function shouldPolyfill(locale?: string |
|
|
1
|
+
export declare function shouldPolyfill(locale?: string): string | undefined;
|
|
2
2
|
//# sourceMappingURL=should-polyfill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-pluralrules/should-polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-pluralrules/should-polyfill.ts"],"names":[],"mappings":"AAWA,wBAAgB,cAAc,CAAC,MAAM,SAAO,sBAS3C"}
|
package/lib/should-polyfill.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { match } from '@formatjs/intl-localematcher';
|
|
2
|
+
import { supportedLocales } from './supported-locales';
|
|
1
3
|
function supportedLocalesOf(locale) {
|
|
2
4
|
if (!locale) {
|
|
3
5
|
return true;
|
|
@@ -6,8 +8,11 @@ function supportedLocalesOf(locale) {
|
|
|
6
8
|
return Intl.PluralRules.supportedLocalesOf(locales).length === locales.length;
|
|
7
9
|
}
|
|
8
10
|
export function shouldPolyfill(locale) {
|
|
9
|
-
|
|
11
|
+
if (locale === void 0) { locale = 'en'; }
|
|
12
|
+
if (!('PluralRules' in Intl) ||
|
|
10
13
|
new Intl.PluralRules('en', { minimumFractionDigits: 2 }).select(1) ===
|
|
11
14
|
'one' ||
|
|
12
|
-
!supportedLocalesOf(locale))
|
|
15
|
+
!supportedLocalesOf(locale)) {
|
|
16
|
+
return locale ? match([locale], supportedLocales, 'en') : undefined;
|
|
17
|
+
}
|
|
13
18
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-locales.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-pluralrules/supported-locales.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAA4nC,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// This file is generated from supported-locales-gen.ts
|
|
2
|
+
export var supportedLocales = ["af", "ak", "am", "an", "ar", "ars", "as", "asa", "ast", "az", "be", "bem", "bez", "bg", "bho", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ce", "ceb", "cgg", "chr", "ckb", "cs", "cy", "da", "de", "doi", "dsb", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fil", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guw", "gv", "ha", "haw", "he", "hi", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "in", "io", "is", "it", "iu", "iw", "ja", "jbo", "jgo", "ji", "jmc", "jv", "jw", "ka", "kab", "kaj", "kcg", "kde", "kea", "kk", "kkj", "kl", "km", "kn", "ko", "ks", "ksb", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lij", "lkt", "ln", "lo", "lt", "lv", "mas", "mg", "mgo", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my", "nah", "naq", "nb", "nd", "ne", "nl", "nn", "nnh", "no", "nqo", "nr", "nso", "ny", "nyn", "om", "or", "os", "osa", "pa", "pap", "pcm", "pl", "prg", "ps", "pt-PT", "pt", "rm", "ro", "rof", "ru", "rwk", "sah", "saq", "sat", "sc", "scn", "sd", "sdh", "se", "seh", "ses", "sg", "sh", "shi", "si", "sk", "sl", "sma", "smi", "smj", "smn", "sms", "sn", "so", "sq", "sr", "ss", "ssy", "st", "su", "sv", "sw", "syr", "ta", "te", "teo", "th", "ti", "tig", "tk", "tl", "tn", "to", "tr", "ts", "tzm", "ug", "uk", "ur", "uz", "ve", "vi", "vo", "vun", "wa", "wae", "wo", "xh", "xog", "yi", "yo", "yue", "zh", "zu"];
|
package/package.json
CHANGED
package/polyfill.iife.js
CHANGED
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
311
311
|
exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
|
|
312
312
|
var ResolveLocale_1 = require_ResolveLocale();
|
|
313
|
-
function
|
|
313
|
+
function match2(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
314
314
|
var locales = availableLocales.reduce(function(all, l) {
|
|
315
315
|
all.add(l);
|
|
316
316
|
return all;
|
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
return defaultLocale;
|
|
322
322
|
}).locale;
|
|
323
323
|
}
|
|
324
|
-
exports.match =
|
|
324
|
+
exports.match = match2;
|
|
325
325
|
var LookupSupportedLocales_1 = require_LookupSupportedLocales();
|
|
326
326
|
Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function() {
|
|
327
327
|
return LookupSupportedLocales_1.LookupSupportedLocales;
|
|
@@ -976,6 +976,12 @@
|
|
|
976
976
|
} catch (ex) {
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/should-polyfill.js
|
|
980
|
+
var import_intl_localematcher4 = __toModule(require_intl_localematcher());
|
|
981
|
+
|
|
982
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/supported-locales.js
|
|
983
|
+
var supportedLocales = ["af", "ak", "am", "an", "ar", "ars", "as", "asa", "ast", "az", "be", "bem", "bez", "bg", "bho", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ce", "ceb", "cgg", "chr", "ckb", "cs", "cy", "da", "de", "doi", "dsb", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fil", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guw", "gv", "ha", "haw", "he", "hi", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "in", "io", "is", "it", "iu", "iw", "ja", "jbo", "jgo", "ji", "jmc", "jv", "jw", "ka", "kab", "kaj", "kcg", "kde", "kea", "kk", "kkj", "kl", "km", "kn", "ko", "ks", "ksb", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lij", "lkt", "ln", "lo", "lt", "lv", "mas", "mg", "mgo", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my", "nah", "naq", "nb", "nd", "ne", "nl", "nn", "nnh", "no", "nqo", "nr", "nso", "ny", "nyn", "om", "or", "os", "osa", "pa", "pap", "pcm", "pl", "prg", "ps", "pt-PT", "pt", "rm", "ro", "rof", "ru", "rwk", "sah", "saq", "sat", "sc", "scn", "sd", "sdh", "se", "seh", "ses", "sg", "sh", "shi", "si", "sk", "sl", "sma", "smi", "smj", "smn", "sms", "sn", "so", "sq", "sr", "ss", "ssy", "st", "su", "sv", "sw", "syr", "ta", "te", "teo", "th", "ti", "tig", "tk", "tl", "tn", "to", "tr", "ts", "tzm", "ug", "uk", "ur", "uz", "ve", "vi", "vo", "vun", "wa", "wae", "wo", "xh", "xog", "yi", "yo", "yue", "zh", "zu"];
|
|
984
|
+
|
|
979
985
|
// bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/should-polyfill.js
|
|
980
986
|
function supportedLocalesOf(locale) {
|
|
981
987
|
if (!locale) {
|
|
@@ -985,7 +991,12 @@
|
|
|
985
991
|
return Intl.PluralRules.supportedLocalesOf(locales).length === locales.length;
|
|
986
992
|
}
|
|
987
993
|
function shouldPolyfill(locale) {
|
|
988
|
-
|
|
994
|
+
if (locale === void 0) {
|
|
995
|
+
locale = "en";
|
|
996
|
+
}
|
|
997
|
+
if (!("PluralRules" in Intl) || new Intl.PluralRules("en", { minimumFractionDigits: 2 }).select(1) === "one" || !supportedLocalesOf(locale)) {
|
|
998
|
+
return locale ? (0, import_intl_localematcher4.match)([locale], supportedLocales, "en") : void 0;
|
|
999
|
+
}
|
|
989
1000
|
}
|
|
990
1001
|
|
|
991
1002
|
// bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/polyfill.js
|
package/should-polyfill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function shouldPolyfill(locale?: string |
|
|
1
|
+
export declare function shouldPolyfill(locale?: string): string | undefined;
|
|
2
2
|
//# sourceMappingURL=should-polyfill.d.ts.map
|
package/should-polyfill.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-pluralrules/should-polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-pluralrules/should-polyfill.ts"],"names":[],"mappings":"AAWA,wBAAgB,cAAc,CAAC,MAAM,SAAO,sBAS3C"}
|
package/should-polyfill.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shouldPolyfill = void 0;
|
|
4
|
+
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
5
|
+
var supported_locales_1 = require("./supported-locales");
|
|
4
6
|
function supportedLocalesOf(locale) {
|
|
5
7
|
if (!locale) {
|
|
6
8
|
return true;
|
|
@@ -9,9 +11,12 @@ function supportedLocalesOf(locale) {
|
|
|
9
11
|
return Intl.PluralRules.supportedLocalesOf(locales).length === locales.length;
|
|
10
12
|
}
|
|
11
13
|
function shouldPolyfill(locale) {
|
|
12
|
-
|
|
14
|
+
if (locale === void 0) { locale = 'en'; }
|
|
15
|
+
if (!('PluralRules' in Intl) ||
|
|
13
16
|
new Intl.PluralRules('en', { minimumFractionDigits: 2 }).select(1) ===
|
|
14
17
|
'one' ||
|
|
15
|
-
!supportedLocalesOf(locale))
|
|
18
|
+
!supportedLocalesOf(locale)) {
|
|
19
|
+
return locale ? (0, intl_localematcher_1.match)([locale], supported_locales_1.supportedLocales, 'en') : undefined;
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
exports.shouldPolyfill = shouldPolyfill;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-locales.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-pluralrules/supported-locales.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAA4nC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportedLocales = void 0;
|
|
4
|
+
// This file is generated from supported-locales-gen.ts
|
|
5
|
+
exports.supportedLocales = ["af", "ak", "am", "an", "ar", "ars", "as", "asa", "ast", "az", "be", "bem", "bez", "bg", "bho", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ce", "ceb", "cgg", "chr", "ckb", "cs", "cy", "da", "de", "doi", "dsb", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fil", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guw", "gv", "ha", "haw", "he", "hi", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "in", "io", "is", "it", "iu", "iw", "ja", "jbo", "jgo", "ji", "jmc", "jv", "jw", "ka", "kab", "kaj", "kcg", "kde", "kea", "kk", "kkj", "kl", "km", "kn", "ko", "ks", "ksb", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lij", "lkt", "ln", "lo", "lt", "lv", "mas", "mg", "mgo", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my", "nah", "naq", "nb", "nd", "ne", "nl", "nn", "nnh", "no", "nqo", "nr", "nso", "ny", "nyn", "om", "or", "os", "osa", "pa", "pap", "pcm", "pl", "prg", "ps", "pt-PT", "pt", "rm", "ro", "rof", "ru", "rwk", "sah", "saq", "sat", "sc", "scn", "sd", "sdh", "se", "seh", "ses", "sg", "sh", "shi", "si", "sk", "sl", "sma", "smi", "smj", "smn", "sms", "sn", "so", "sq", "sr", "ss", "ssy", "st", "su", "sv", "sw", "syr", "ta", "te", "teo", "th", "ti", "tig", "tk", "tl", "tn", "to", "tr", "ts", "tzm", "ug", "uk", "ur", "uz", "ve", "vi", "vo", "vun", "wa", "wae", "wo", "xh", "xog", "yi", "yo", "yue", "zh", "zu"];
|