Skip to content

Commit 34283ad

Browse files
committed
Implement Intl Locale Info proposal
1 parent b263cc4 commit 34283ad

File tree

1 file changed

+85
-1
lines changed

1 file changed

+85
-1
lines changed

src/lib/esnext.intl.d.ts

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,87 @@
11
declare namespace Intl {
2-
// Empty
2+
interface Locale {
3+
/**
4+
* Returns a list of one or more unique calendar identifiers for this locale.
5+
*
6+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCalendars)
7+
*/
8+
getCalendars(): string[];
9+
/**
10+
* Returns a list of one or more collation types for this locale.
11+
*
12+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCollations)
13+
*/
14+
getCollations(): string[];
15+
/**
16+
* Returns a list of one or more unique hour cycle identifiers for this locale.
17+
*
18+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getHourCycles)
19+
*/
20+
getHourCycles(): string[];
21+
/**
22+
* Returns a list of one or more unique numbering system identifiers for this locale.
23+
*
24+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getNumberingSystems)
25+
*/
26+
getNumberingSystems(): string[];
27+
/**
28+
* Returns the ordering of characters indicated by either ltr (left-to-right) or by rtl (right-to-left) for this locale.
29+
*
30+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo)
31+
*/
32+
getTextInfo(): TextInfo;
33+
/**
34+
* Returns a list of supported time zones for this locale.
35+
*
36+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTimeZones)
37+
*/
38+
getTimeZones(): string[];
39+
/**
40+
* Returns a `WeekInfo` object with the properties `firstDay`, `weekend` and `minimalDays` for this locale.
41+
*
42+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo)
43+
*/
44+
getWeekInfo(): WeekInfo;
45+
}
46+
47+
/**
48+
* An object representing text typesetting information associated with the Locale data specified in UTS 35's Layouts Elements.
49+
*
50+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo#return_value)
51+
*/
52+
interface TextInfo {
53+
/**
54+
* A string indicating the direction of text for the locale. Can be either "ltr" (left-to-right) or "rtl" (right-to-left).
55+
*
56+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo#direction)
57+
*/
58+
direction: "ltr" | "rtl";
59+
}
60+
61+
/**
62+
* An object representing week information associated with the Locale data specified in UTS 35's Week Elements.
63+
*
64+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo#return_value)
65+
*/
66+
interface WeekInfo {
67+
/**
68+
* An integer between 1 (Monday) and 7 (Sunday) indicating the first day of the week for the locale. Commonly 1, 5, 6, or 7.
69+
*
70+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo#firstday)
71+
*/
72+
firstDay: number;
73+
/**
74+
* An array of integers between 1 and 7 indicating the weekend days for the locale.
75+
*
76+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo#weekend)
77+
*/
78+
weekend: number[];
79+
/**
80+
* An integer between 1 and 7 (commonly 1 and 4) indicating the minimal days required in the
81+
* first week of a month or year, for week-of-year or week-of-month calculations (e.g. The 20th week of the year).
82+
*
83+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo#minimaldays)
84+
*/
85+
minimalDays: number;
86+
}
387
}

0 commit comments

Comments
 (0)