• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1declare namespace Intl {
2
3    // http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories
4    type LDMLPluralRule = "zero" | "one" | "two" | "few" | "many" | "other";
5    type PluralRuleType = "cardinal" | "ordinal";
6
7    interface PluralRulesOptions {
8        localeMatcher?: "lookup" | "best fit";
9        type?: PluralRuleType;
10        minimumIntegerDigits?: number;
11        minimumFractionDigits?: number;
12        maximumFractionDigits?: number;
13        minimumSignificantDigits?: number;
14        maximumSignificantDigits?: number;
15    }
16
17    interface ResolvedPluralRulesOptions {
18        locale: string;
19        pluralCategories: LDMLPluralRule[];
20        type: PluralRuleType;
21        minimumIntegerDigits: number;
22        minimumFractionDigits: number;
23        maximumFractionDigits: number;
24        minimumSignificantDigits?: number;
25        maximumSignificantDigits?: number;
26    }
27
28    interface PluralRules {
29        resolvedOptions(): ResolvedPluralRulesOptions;
30        select(n: number): LDMLPluralRule;
31    }
32
33    const PluralRules: {
34        new (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
35        (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
36        supportedLocalesOf(
37            locales: string | string[],
38            options?: PluralRulesOptions,
39        ): string[];
40    };
41}
42