|
1 | 1 | type t
|
2 | 2 |
|
| 3 | +type localeType = [#cardinal | #ordinal] |
| 4 | + |
| 5 | +type options = { |
| 6 | + localeMatcher?: Core__Intl__Common.localeMatcher, |
| 7 | + \"type"?: localeType, |
| 8 | + // use either this group |
| 9 | + minimumIntegerDigits?: Core__Intl__Common.oneTo21, |
| 10 | + minimumFractionDigits?: Core__Intl__Common.zeroTo20, |
| 11 | + maximumFractionDigits?: Core__Intl__Common.zeroTo20, |
| 12 | + // OR this group |
| 13 | + minimumSignificantDigits?: Core__Intl__Common.oneTo21, |
| 14 | + maximumSignificantDigits?: Core__Intl__Common.oneTo21, |
| 15 | +} |
| 16 | + |
| 17 | +type pluralCategories = [ |
| 18 | + | #zero |
| 19 | + | #one |
| 20 | + | #two |
| 21 | + | #few |
| 22 | + | #many |
| 23 | + | #other |
| 24 | +] |
| 25 | + |
| 26 | +type resolvedOptions = { |
| 27 | + locale: string, |
| 28 | + pluralCategories: array<pluralCategories>, |
| 29 | + \"type": localeType, |
| 30 | + // either this group |
| 31 | + minimumIntegerDigits?: Core__Intl__Common.oneTo21, |
| 32 | + minimumFractionDigits?: Core__Intl__Common.zeroTo20, |
| 33 | + maximumFractionDigits?: Core__Intl__Common.zeroTo20, |
| 34 | + // OR this group |
| 35 | + minimumSignificantDigits?: Core__Intl__Common.oneTo21, |
| 36 | + maximumSignificantDigits?: Core__Intl__Common.oneTo21, |
| 37 | +} |
| 38 | + |
| 39 | +type supportedLocalesOptions = {localeMatcher: Core__Intl__Common.localeMatcher} |
| 40 | + |
3 | 41 | @new external make: unit => t = "Intl.PluralRules"
|
4 | 42 | @new external makeWithLocale: string => t = "Intl.PluralRules"
|
5 | 43 | @new external makeWithLocales: array<string> => t = "Intl.PluralRules"
|
6 |
| -@new external makeWithLocaleAndOptions: (string, {..}) => t = "Intl.PluralRules" |
7 |
| -@new external makeWithLocalesAndOptions: (array<string>, {..}) => t = "Intl.PluralRules" |
8 |
| -@new external makeWithOptions: (@as(json`undefined`) _, {..}) => t = "Intl.PluralRules" |
| 44 | +@new external makeWithLocaleAndOptions: (string, options) => t = "Intl.PluralRules" |
| 45 | +@new external makeWithLocalesAndOptions: (array<string>, options) => t = "Intl.PluralRules" |
| 46 | +@new external makeWithOptions: (@as(json`undefined`) _, options) => t = "Intl.PluralRules" |
9 | 47 |
|
10 | 48 | @val external supportedLocalesOf: array<string> => t = "Intl.PluralRules.supportedLocalesOf"
|
11 | 49 | @val
|
12 |
| -external supportedLocalesOfWithOptions: (array<string>, {..}) => t = |
| 50 | +external supportedLocalesOfWithOptions: (array<string>, supportedLocalesOptions) => t = |
13 | 51 | "Intl.PluralRules.supportedLocalesOf"
|
14 | 52 |
|
15 |
| -@send external resolvedOptions: t => {..} = "resolvedOptions" |
| 53 | +@send external resolvedOptions: t => resolvedOptions = "resolvedOptions" |
16 | 54 |
|
17 | 55 | type rule = [#zero | #one | #two | #few | #many | #other]
|
18 | 56 |
|
19 | 57 | @send external select: (t, float) => rule = "select"
|
20 | 58 | @send external selectInt: (t, int) => rule = "select"
|
21 | 59 | @send external selectBigInt: (t, Core__BigInt.t) => rule = "select"
|
| 60 | + |
| 61 | +/** |
| 62 | +Not supported in Firefox v110 |
| 63 | +*/ |
| 64 | +@send |
| 65 | +external selectRange: (t, ~start: float, ~end: float) => rule = "selectRange" |
| 66 | +/** |
| 67 | +Not supported in Firefox v110 |
| 68 | +*/ |
| 69 | +@send |
| 70 | +external selectRangeInt: (t, ~start: int, ~end: int) => rule = "selectRange" |
| 71 | +/** |
| 72 | +Not supported in Firefox v110 |
| 73 | +*/ |
| 74 | +@send |
| 75 | +external selectRangeBigInt: (t, ~start: Core__BigInt.t, ~end: Core__BigInt.t) => rule = |
| 76 | + "selectRange" |
0 commit comments