@formatjs/intl-pluralrules 6.1.0 → 6.1.2
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/abstract/GetOperands.d.ts +28 -28
- package/abstract/GetOperands.js +41 -43
- package/abstract/InitializePluralRules.d.ts +7 -7
- package/abstract/InitializePluralRules.js +15 -16
- package/abstract/ResolvePlural.d.ts +11 -11
- package/abstract/ResolvePlural.js +19 -20
- package/get_internal_slots.d.ts +4 -1
- package/get_internal_slots.js +8 -7
- package/index.d.ts +16 -16
- package/index.js +124 -138
- package/package.json +5 -5
- package/polyfill-force.js +6 -6
- package/polyfill.iife.js +2369 -3038
- package/polyfill.js +8 -8
- package/should-polyfill.js +11 -15
- package/supported-locales.generated.js +217 -1
package/polyfill.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PluralRules } from
|
|
2
|
-
import { shouldPolyfill } from
|
|
1
|
+
import { PluralRules } from "./index.js";
|
|
2
|
+
import { shouldPolyfill } from "./should-polyfill.js";
|
|
3
3
|
if (shouldPolyfill()) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Object.defineProperty(Intl, "PluralRules", {
|
|
5
|
+
value: PluralRules,
|
|
6
|
+
writable: true,
|
|
7
|
+
enumerable: false,
|
|
8
|
+
configurable: true
|
|
9
|
+
});
|
|
10
10
|
}
|
package/should-polyfill.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { match } from
|
|
2
|
-
import { supportedLocales } from
|
|
1
|
+
import { match } from "@formatjs/intl-localematcher";
|
|
2
|
+
import { supportedLocales } from "./supported-locales.generated.js";
|
|
3
3
|
function supportedLocalesOf(locale) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
if (!locale) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
const locales = Array.isArray(locale) ? locale : [locale];
|
|
8
|
+
return Intl.PluralRules.supportedLocalesOf(locales).length === locales.length;
|
|
9
9
|
}
|
|
10
|
-
export function shouldPolyfill(locale) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'one' ||
|
|
15
|
-
!supportedLocalesOf(locale)) {
|
|
16
|
-
return locale ? match([locale], supportedLocales, 'en') : undefined;
|
|
17
|
-
}
|
|
10
|
+
export function shouldPolyfill(locale = "en") {
|
|
11
|
+
if (!("PluralRules" in Intl) || new Intl.PluralRules("en", { minimumFractionDigits: 2 }).select(1) === "one" || !supportedLocalesOf(locale)) {
|
|
12
|
+
return locale ? match([locale], supportedLocales, "en") : undefined;
|
|
13
|
+
}
|
|
18
14
|
}
|
|
@@ -1 +1,217 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const supportedLocales = [
|
|
2
|
+
"af",
|
|
3
|
+
"ak",
|
|
4
|
+
"am",
|
|
5
|
+
"an",
|
|
6
|
+
"ar",
|
|
7
|
+
"ars",
|
|
8
|
+
"as",
|
|
9
|
+
"asa",
|
|
10
|
+
"ast",
|
|
11
|
+
"az",
|
|
12
|
+
"bal",
|
|
13
|
+
"be",
|
|
14
|
+
"bem",
|
|
15
|
+
"bez",
|
|
16
|
+
"bg",
|
|
17
|
+
"bho",
|
|
18
|
+
"bm",
|
|
19
|
+
"bn",
|
|
20
|
+
"bo",
|
|
21
|
+
"br",
|
|
22
|
+
"brx",
|
|
23
|
+
"bs",
|
|
24
|
+
"ca",
|
|
25
|
+
"ce",
|
|
26
|
+
"ceb",
|
|
27
|
+
"cgg",
|
|
28
|
+
"chr",
|
|
29
|
+
"ckb",
|
|
30
|
+
"cs",
|
|
31
|
+
"cy",
|
|
32
|
+
"da",
|
|
33
|
+
"de",
|
|
34
|
+
"doi",
|
|
35
|
+
"dsb",
|
|
36
|
+
"dv",
|
|
37
|
+
"dz",
|
|
38
|
+
"ee",
|
|
39
|
+
"el",
|
|
40
|
+
"en",
|
|
41
|
+
"eo",
|
|
42
|
+
"es",
|
|
43
|
+
"et",
|
|
44
|
+
"eu",
|
|
45
|
+
"fa",
|
|
46
|
+
"ff",
|
|
47
|
+
"fi",
|
|
48
|
+
"fil",
|
|
49
|
+
"fo",
|
|
50
|
+
"fr",
|
|
51
|
+
"fur",
|
|
52
|
+
"fy",
|
|
53
|
+
"ga",
|
|
54
|
+
"gd",
|
|
55
|
+
"gl",
|
|
56
|
+
"gsw",
|
|
57
|
+
"gu",
|
|
58
|
+
"guw",
|
|
59
|
+
"gv",
|
|
60
|
+
"ha",
|
|
61
|
+
"haw",
|
|
62
|
+
"he",
|
|
63
|
+
"hi",
|
|
64
|
+
"hnj",
|
|
65
|
+
"hr",
|
|
66
|
+
"hsb",
|
|
67
|
+
"hu",
|
|
68
|
+
"hy",
|
|
69
|
+
"ia",
|
|
70
|
+
"id",
|
|
71
|
+
"ig",
|
|
72
|
+
"ii",
|
|
73
|
+
"io",
|
|
74
|
+
"is",
|
|
75
|
+
"it",
|
|
76
|
+
"iu",
|
|
77
|
+
"ja",
|
|
78
|
+
"jbo",
|
|
79
|
+
"jgo",
|
|
80
|
+
"jmc",
|
|
81
|
+
"jv",
|
|
82
|
+
"jw",
|
|
83
|
+
"ka",
|
|
84
|
+
"kab",
|
|
85
|
+
"kaj",
|
|
86
|
+
"kcg",
|
|
87
|
+
"kde",
|
|
88
|
+
"kea",
|
|
89
|
+
"kk",
|
|
90
|
+
"kkj",
|
|
91
|
+
"kl",
|
|
92
|
+
"km",
|
|
93
|
+
"kn",
|
|
94
|
+
"ko",
|
|
95
|
+
"ks",
|
|
96
|
+
"ksb",
|
|
97
|
+
"ksh",
|
|
98
|
+
"ku",
|
|
99
|
+
"kw",
|
|
100
|
+
"ky",
|
|
101
|
+
"lag",
|
|
102
|
+
"lb",
|
|
103
|
+
"lg",
|
|
104
|
+
"lij",
|
|
105
|
+
"lkt",
|
|
106
|
+
"ln",
|
|
107
|
+
"lo",
|
|
108
|
+
"lt",
|
|
109
|
+
"lv",
|
|
110
|
+
"mas",
|
|
111
|
+
"mg",
|
|
112
|
+
"mgo",
|
|
113
|
+
"mk",
|
|
114
|
+
"ml",
|
|
115
|
+
"mn",
|
|
116
|
+
"mo",
|
|
117
|
+
"mr",
|
|
118
|
+
"ms",
|
|
119
|
+
"mt",
|
|
120
|
+
"my",
|
|
121
|
+
"nah",
|
|
122
|
+
"naq",
|
|
123
|
+
"nb",
|
|
124
|
+
"nd",
|
|
125
|
+
"ne",
|
|
126
|
+
"nl",
|
|
127
|
+
"nn",
|
|
128
|
+
"nnh",
|
|
129
|
+
"no",
|
|
130
|
+
"nqo",
|
|
131
|
+
"nr",
|
|
132
|
+
"nso",
|
|
133
|
+
"ny",
|
|
134
|
+
"nyn",
|
|
135
|
+
"om",
|
|
136
|
+
"or",
|
|
137
|
+
"os",
|
|
138
|
+
"osa",
|
|
139
|
+
"pa",
|
|
140
|
+
"pap",
|
|
141
|
+
"pcm",
|
|
142
|
+
"pl",
|
|
143
|
+
"prg",
|
|
144
|
+
"ps",
|
|
145
|
+
"pt",
|
|
146
|
+
"pt-PT",
|
|
147
|
+
"rm",
|
|
148
|
+
"ro",
|
|
149
|
+
"rof",
|
|
150
|
+
"ru",
|
|
151
|
+
"rwk",
|
|
152
|
+
"sah",
|
|
153
|
+
"saq",
|
|
154
|
+
"sat",
|
|
155
|
+
"sc",
|
|
156
|
+
"scn",
|
|
157
|
+
"sd",
|
|
158
|
+
"sdh",
|
|
159
|
+
"se",
|
|
160
|
+
"seh",
|
|
161
|
+
"ses",
|
|
162
|
+
"sg",
|
|
163
|
+
"sh",
|
|
164
|
+
"shi",
|
|
165
|
+
"si",
|
|
166
|
+
"sk",
|
|
167
|
+
"sl",
|
|
168
|
+
"sma",
|
|
169
|
+
"smi",
|
|
170
|
+
"smj",
|
|
171
|
+
"smn",
|
|
172
|
+
"sms",
|
|
173
|
+
"sn",
|
|
174
|
+
"so",
|
|
175
|
+
"sq",
|
|
176
|
+
"sr",
|
|
177
|
+
"ss",
|
|
178
|
+
"ssy",
|
|
179
|
+
"st",
|
|
180
|
+
"su",
|
|
181
|
+
"sv",
|
|
182
|
+
"sw",
|
|
183
|
+
"syr",
|
|
184
|
+
"ta",
|
|
185
|
+
"te",
|
|
186
|
+
"teo",
|
|
187
|
+
"th",
|
|
188
|
+
"ti",
|
|
189
|
+
"tig",
|
|
190
|
+
"tk",
|
|
191
|
+
"tl",
|
|
192
|
+
"tn",
|
|
193
|
+
"to",
|
|
194
|
+
"tpi",
|
|
195
|
+
"tr",
|
|
196
|
+
"ts",
|
|
197
|
+
"tzm",
|
|
198
|
+
"ug",
|
|
199
|
+
"uk",
|
|
200
|
+
"und",
|
|
201
|
+
"ur",
|
|
202
|
+
"uz",
|
|
203
|
+
"ve",
|
|
204
|
+
"vi",
|
|
205
|
+
"vo",
|
|
206
|
+
"vun",
|
|
207
|
+
"wa",
|
|
208
|
+
"wae",
|
|
209
|
+
"wo",
|
|
210
|
+
"xh",
|
|
211
|
+
"xog",
|
|
212
|
+
"yi",
|
|
213
|
+
"yo",
|
|
214
|
+
"yue",
|
|
215
|
+
"zh",
|
|
216
|
+
"zu"
|
|
217
|
+
];
|