UNPKG

2.29 kBTypeScriptView Raw
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation. All rights reserved.
3Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4this file except in compliance with the License. You may obtain a copy of the
5License at http://www.apache.org/licenses/LICENSE-2.0
6
7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10MERCHANTABLITY OR NON-INFRINGEMENT.
11
12See the Apache Version 2.0 License for specific language governing permissions
13and limitations under the License.
14***************************************************************************** */
15
16
17
18/// <reference no-default-lib="true"/>
19
20
21declare namespace Intl {
22
23 // http://cldr.unicode.org/index/cldr-spec/plural-rules#TOC-Determining-Plural-Categories
24 type LDMLPluralRule = "zero" | "one" | "two" | "few" | "many" | "other";
25 type PluralRuleType = "cardinal" | "ordinal";
26
27 interface PluralRulesOptions {
28 localeMatcher?: "lookup" | "best fit";
29 type?: PluralRuleType;
30 minimumIntegerDigits?: number;
31 minimumFractionDigits?: number;
32 maximumFractionDigits?: number;
33 minimumSignificantDigits?: number;
34 maximumSignificantDigits?: number;
35 }
36
37 interface ResolvedPluralRulesOptions {
38 locale: string;
39 pluralCategories: LDMLPluralRule[];
40 type: PluralRuleType;
41 minimumIntegerDigits: number;
42 minimumFractionDigits: number;
43 maximumFractionDigits: number;
44 minimumSignificantDigits?: number;
45 maximumSignificantDigits?: number;
46 }
47
48 interface PluralRules {
49 resolvedOptions(): ResolvedPluralRulesOptions;
50 select(n: number): LDMLPluralRule;
51 }
52
53 const PluralRules: {
54 new (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
55 (locales?: string | string[], options?: PluralRulesOptions): PluralRules;
56 supportedLocalesOf(
57 locales: string | string[],
58 options?: PluralRulesOptions,
59 ): string[];
60 };
61}