├── .gitattributes
├── .github
└── workflows
│ └── build.yml
├── .gitignore
├── .npmrc
├── LICENSE
├── README.md
├── biblio.json
├── displaynames.html
├── index.html
├── package.json
└── spec.emu
/.gitattributes:
--------------------------------------------------------------------------------
1 | index.html -diff merge=ours
2 | spec.js -diff merge=ours
3 | spec.css -diff merge=ours
4 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Deploy spec
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 |
9 | steps:
10 | - uses: actions/checkout@v2
11 | - uses: actions/setup-node@v1
12 | with:
13 | node-version: '12.x'
14 | - run: npm install
15 | - run: npm run build
16 | - name: commit changes
17 | uses: elstudio/actions-js-build/commit@v3
18 | with:
19 | commitMessage: "fixup: [spec] `npm run build`"
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Runtime data
7 | pids
8 | *.pid
9 | *.seed
10 |
11 | # Directory for instrumented libs generated by jscoverage/JSCover
12 | lib-cov
13 |
14 | # Coverage directory used by tools like istanbul
15 | coverage
16 |
17 | # nyc test coverage
18 | .nyc_output
19 |
20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21 | .grunt
22 |
23 | # node-waf configuration
24 | .lock-wscript
25 |
26 | # Compiled binary addons (http://nodejs.org/api/addons.html)
27 | build/Release
28 |
29 | # Dependency directories
30 | node_modules
31 | jspm_packages
32 |
33 | # Optional npm cache directory
34 | .npm
35 |
36 | # Optional REPL history
37 | .node_repl_history
38 |
39 | # Only apps should have lockfiles
40 | yarn.lock
41 | package-lock.json
42 | npm-shrinkwrap.json
43 | pnpm-lock.yaml
44 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | package-lock=false
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 ECMA TC39 and contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Proposal: Intl.DisplayNames V2
2 |
3 | ## Stage
4 | Stage 3
5 |
6 | * Advanced to [Stage 1](https://docs.google.com/presentation/d/11Ch4Y9yYzMJjznX478Y0QbbCGiOAXbOzLjpYnMH9eck/edit#slide=id.g98718c7875_0_0) in TC39 2020-09 meeting.
7 | * Advanced to [Stage 2](https://docs.google.com/presentation/d/1Fsr1BhK11rCNgwEMGtwrMq5arpQv2hlEsA2SRiZSTx4/) in [TC39 2021-01-25~28 meeting](https://github.com/tc39/agendas/blob/master/2021/01.md).
8 | * Proposed for [Stage 3](https://docs.google.com/presentation/d/1_BR2bq6gi_i9QjDDluv683cuO2AXNwZl-3hXC4gLl3M/edit) in [TC39 2021 April meeting](https://github.com/tc39/agendas/blob/master/2021/04.md) but not reaching consensus due to [issues related to dialectHandling](https://github.com/tc39/intl-displaynames-v2/issues/29) and [user requests of 'unit' support](https://github.com/tc39/intl-displaynames-v2/issues/2).
9 | * Advanced to [Stage 3](https://docs.google.com/presentation/d/1hxhwHyJLYT32NYrKLTCDLhZHN6OVZEamJppLLlSmyi0) in [TC39 2021-05-25~26 meeting](https://github.com/tc39/agendas/blob/master/2021/05.md).
10 | * Update during [Stage 3](https://docs.google.com/presentation/d/1EUJ8fIBcCN784S_Da5FT8Fxgo1_lVM8InbSUjhuvpkU) in [TC39 2021-07-13~16 meeting](https://github.com/tc39/agendas/blob/master/2021/07.md)
11 | * [Slide for Stage 4 Advacement for TC39 2021-Dec meeting](https://docs.google.com/presentation/d/1bvfdKBVNRUH7J18WGnxR02CKZJ_z3QThp3fLWdMqmzE/)
12 |
13 |
14 | ## Champion
15 | * Frank Tang @FrankYFTang
16 |
17 | ## Reviwers
18 | * Shane Carr @sffc
19 | * Ujjwal Sharma @ryzokuken
20 |
21 | ## Editors
22 | * Richard Gibson @gibson042
23 |
24 | ## Motivation
25 | Main motivation for Intl.DisplayNames project was to enable developers to get translation of language, region or script display names on the client. Translation of languages, regions or script display names requires large amount of data to transmit on the network, which is already available in most browsers. These display name translations also carry steep data size penalty for developers. This API will allow web developers to shrink the size of their HTML and/ or ECMA script code without the need to include the human readable form of display names and therefore reduce the download size to decrease latency. Also, this API will reduce the localization cost for the web developers. Our goal is to expose this data through Intl API for use in e.g. language, region and script pickers, etc.
26 |
27 | In Intl.DisplayNames API, we already cover language, region, script, and currency. This proposal enhance the Intl.DisplayNames API and cover more.
28 |
29 | Please also see prior work of the first version of Intl.DisplayNames on [the Intl.DisplayNames repo](https://github.com/tc39/proposal-intl-displaynames/)
30 |
31 | ## Scoped Enhancements
32 | * Date Time Field
33 | * [Calendar Names](https://github.com/tc39/proposal-intl-displaynames/issues/69)
34 | * Language Display : standard vs dialect
35 |
36 | Changes of scope
37 | * During 2021-01 ECMA402 meeting, we decided not to include Weekday, Month, TimeZone, and Numbering System.
38 | * During 2021-03-11 ECMA402 meeting, we decided to add back dateTimeField.
39 | * During 2021-04-08 ECMA402 meeting, we agree the name of the dialectHandling and proceed to TC39 for Stage 3. Shane and Ujjwal agreed to be Stage 3 reviewers.
40 | * During 2021-05-06 ECMA402 meeting, we agree to drop the "unit" support and rename dialectHandling to languageDisplay.
41 |
42 | ## Examples
43 |
44 | ### Calender Names
45 | ```
46 | d8> dn = new Intl.DisplayNames("en", {type: "calendar"})
47 | d8> dn.of("roc")
48 | "Minguo Calendar"
49 | d8> dn.of("persian")
50 | "Persian Calendar"
51 | d8> dn.of("gregory")
52 | "Gregorian Calendar"
53 | d8> dn.of("ethioaa")
54 | "Ethiopic Amete Alem Calendar"
55 | d8> dn.of("japanese")
56 | "Japanese Calendar"
57 | d8> dn.of("dangi")
58 | "Dangi Calendar"
59 | d8> dn.of("chinese")
60 | "Chinese Calendar"
61 |
62 |
63 | d8> dn = new Intl.DisplayNames("zh", {type: "calendar"})
64 | d8> dn.of("roc")
65 | "民国纪年"
66 | d8> dn.of("persian")
67 | "波斯历"
68 | d8> dn.of("gregory")
69 | "公历"
70 | d8> dn.of("ethioaa")
71 | "埃塞俄比亚阿米特阿莱姆日历"
72 | d8> dn.of("japanese")
73 | "和历"
74 | d8> dn.of("dangi")
75 | "檀纪历"
76 | 8> dn.of("chinese")
77 | "农历"
78 | ```
79 |
80 | ### Date Time Field Names
81 | ```
82 | $ out/x64.release/d8 --harmony_intl_displaynames_v2
83 | d8> dn = new Intl.DisplayNames("zh", {type: "dateTimeField"})
84 | [object Intl.DisplayNames]
85 | d8> dn.of("era")
86 | "纪元"
87 | d8> dn.of("year")
88 | "年"
89 | d8> dn.of("month")
90 | "月"
91 | d8> dn.of("quarter")
92 | "季度"
93 | d8> dn.of("weekOfYear")
94 | "周"
95 | d8> dn.of("weekday")
96 | "工作日"
97 | d8> dn.of("dayPeriod")
98 | "上午/下午"
99 | d8> dn.of("day")
100 | "日"
101 | d8> dn.of("hour")
102 | "小时"
103 | d8> dn.of("minute")
104 | "分钟"
105 | d8> dn.of("second")
106 | "秒"
107 |
108 | d8> dn = new Intl.DisplayNames("es", {type: "dateTimeField"})
109 | [object Intl.DisplayNames]
110 | d8> dn.of("era")
111 | "era"
112 | d8> dn.of("year")
113 | "año"
114 | d8> dn.of("month")
115 | "mes"
116 | d8> dn.of("quarter")
117 | "trimestre"
118 | d8> dn.of("weekOfYear")
119 | "semana"
120 | d8> dn.of("weekday")
121 | "día de la semana"
122 | d8> dn.of("dayPeriod")
123 | "a. m./p. m."
124 | d8> dn.of("day")
125 | "día"
126 | d8> dn.of("hour")
127 | "hora"
128 | d8> dn.of("minute")
129 | "minuto"
130 | d8> dn.of("second")
131 | "segundo"
132 | ```
133 |
134 | ### Language Display
135 | ```
136 | ~/v8/v8$ out/x64.release/d8 --harmony_intl_displaynames_v2
137 | V8 version 9.1.0 (candidate)
138 | d8> dn1 = new Intl.DisplayNames("en", {type: "language"})
139 | [object Intl.DisplayNames]
140 | d8> dn1.of("en")
141 | "English"
142 | d8> dn1.of("en-GB")
143 | "British English"
144 | d8> dn1.of("en-US")
145 | "American English"
146 | d8> dn1.of("en-AU")
147 | "Australian English"
148 | d8> dn1.of("en-CA")
149 | "Canadian English"
150 | d8> dn1.of("zh")
151 | "Chinese"
152 | d8> dn1.of("zh-Hant")
153 | "Traditional Chinese"
154 | d8> dn1.of("zh-Hans")
155 | "Simplified Chinese"
156 |
157 | // Same as above
158 | d8> dn2 = new Intl.DisplayNames("en", {type: "language", languageDisplay: "dialect"})
159 | [object Intl.DisplayNames]
160 | d8> dn2.of("en")
161 | "English"
162 | d8> dn2.of("en-GB")
163 | "British English"
164 | d8> dn2.of("en-US")
165 | "American English"
166 | d8> dn2.of("en-AU")
167 | "Australian English"
168 | d8> dn2.of("en-CA")
169 | "Canadian English"
170 | d8> dn2.of("zh")
171 | "Chinese"
172 | d8> dn2.of("zh-Hant")
173 | "Traditional Chinese"
174 | d8> dn2.of("zh-Hans")
175 | "Simplified Chinese"
176 |
177 | // Now switch to standard name
178 | d8> dn3 = new Intl.DisplayNames("en", {type: "language", languageDisplay: "standard"})
179 | [object Intl.DisplayNames]
180 | d8> dn3.of("en")
181 | "English"
182 | d8> dn3.of("en-GB")
183 | "English (United Kingdom)"
184 | d8> dn3.of("en-AU")
185 | "English (Australia)"
186 | d8> dn3.of("en-CA")
187 | "English (Canada)"
188 | d8> dn3.of("en-US")
189 | "English (United States)"
190 | d8> dn3.of("zh")
191 | "Chinese"
192 | d8> dn3.of("zh-Hant")
193 | "Chinese (Traditional)"
194 | d8> dn3.of("zh-Hans")
195 | "Chinese (Simplified)"
196 | ```
197 |
198 | ## Discussed Scopes during Stage 1
199 |
200 | * Extending Types:
201 | * ~~[Weekday and Month Names](https://github.com/tc39/proposal-intl-displaynames/issues/75)~~
202 | * [Unit Names](https://github.com/tc39/proposal-intl-displaynames/issues/34)
203 | * ~~[TimeZone Names](https://github.com/tc39/proposal-intl-displaynames/issues/17)~~
204 | * [Calendar Names](https://github.com/tc39/proposal-intl-displaynames/issues/69)
205 | * ~~[Numbering System Names](https://github.com/tc39/proposal-intl-displaynames/issues/68)~~
206 | * ~~Quarter~~
207 | * ~~Day Period~~
208 | * ~~Date Time Field~~
209 | * Enhance Features:
210 | * [Supporing Dialect](https://github.com/tc39/proposal-intl-displaynames/issues/20)
211 |
212 | ## Discussed Scopes during Stage 2
213 | * 2021-03-11: Add back dateTimeField
214 | * 2021-05-06: Remove unit
215 |
216 | ## Entrance Criteria For Stage 3
217 | * All Stage 2 Criterias
218 | * Complete spec text
219 | * Designated reviewers have signed off on the current spec text
220 | * All ECMAScript editors have signed off on the current spec text
221 |
222 | ## Entrance Criteria For Stage 2
223 | * All Stage 1 Criterias
224 | * Initial spec text
225 |
226 | ## Entrance Criteria For Stage 1
227 |
228 | * Identified “champion” who will advance the addition: **DONE- @FrankYFTang**
229 | * Prose outlining the problem or need and the general shape of a solution
230 | * Illustrative examples of usage
231 | * High-level API
232 | * Discussion of key algorithms, abstractions and semantics
233 | * Identification of potential “cross-cutting” concerns and implementation challenges/complexity
234 | * A publicly available repository for the proposal that captures the above requirements: **DONE https://github.com/tc39/intl-displaynames-v2**
235 |
236 | ## Experimentals
237 | * [V8 Prototype](https://chromium-review.googlesource.com/c/v8/v8/+/2924523)
238 | * Implement new types "calendar", "dateTimeField", and "unit" and add dialectHandling option
239 | * [Mozilla Tracking Bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1693575)
240 |
--------------------------------------------------------------------------------
/biblio.json:
--------------------------------------------------------------------------------
1 | {
2 | "https://tc39.es/ecma402/": [
3 | {
4 | "type": "op",
5 | "aoid": "GetOption",
6 | "id": "sec-getoption"
7 | },
8 | {
9 | "type": "op",
10 | "aoid": "ResolveLocale",
11 | "id": "sec-resolvelocale"
12 | },
13 | {
14 | "type": "op",
15 | "aoid": "IsWellFormedCurrencyCode",
16 | "id": "sec-iswellformedcurrencycode"
17 | },
18 | {
19 | "type": "op",
20 | "aoid": "CanonicalizeLocaleList",
21 | "id": "sec-canonicalizelocalelist"
22 | },
23 | {
24 | "type": "op",
25 | "aoid": "CanonicalizeUnicodeLocaleId",
26 | "id": "sec-canonicalizeunicodelocaleid"
27 | },
28 | {
29 | "type": "op",
30 | "aoid": "IsStructurallyValidLanguageTag",
31 | "id": "sec-isstructurallyvalidlanguagetag"
32 | },
33 | {
34 | "type": "op",
35 | "aoid": "SupportedLocales",
36 | "id": "sec-supportedlocales"
37 | },
38 | {
39 | "type": "op",
40 | "aoid": "IsWellFormedUnitIdentifier",
41 | "id": "sec-iswellformedunitidentifier"
42 | },
43 | {
44 | "type": "op",
45 | "aoid": "IsValidTimeZoneName",
46 | "id": "sec-isvalidtimezonename"
47 | },
48 | {
49 | "type": "op",
50 | "aoid": "CanonicalizeTimeZoneName",
51 | "id": "sec-canonicalizetimezonenam"
52 | },
53 | {
54 | "type": "clause",
55 | "number": "6.1",
56 | "id": "sec-case-sensitivity-and-case-mapping"
57 | },
58 | {
59 | "type": "term",
60 | "term": "legacy-constructor",
61 | "refId": "sec-constructor-properties-of-the-intl-object",
62 | "id": "legacy-constructor"
63 | },
64 | {
65 | "type": "clause",
66 | "number": "9.1",
67 | "id": "sec-internal-slots"
68 | },
69 | {
70 | "type": "clause",
71 | "number": "6.1",
72 | "id": "sec-case-sensitivity-and-case-mapping"
73 | }
74 | ]
75 | }
76 |
--------------------------------------------------------------------------------
/displaynames.html:
--------------------------------------------------------------------------------
1 |
11 | The CanonicalCodeForDisplayNames abstract operation is called with arguments _type_, _code_. It verifies that the _code_ argument represents a well-formed code according to the _type_ argument and returns the case-regularized form of the _code_. The algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar. The following steps are taken:
12 |
45 |
46 | The IsValidDateTimeFieldCode abstract operation is called with argument _field_. It verifies that the _field_ argument represents a valid date time field code. The following steps are taken:
47 |
48 |
120 | The DisplayNames constructor is a standard built-in property of the Intl object.
126 | When the *Intl.DisplayNames* function is called with arguments _locales_ and _options_, the following steps are taken:
127 |
170 | The Intl.DisplayNames constructor has the following properties:
171 |
177 | The value of *Intl.DisplayNames.prototype* is *%DisplayNamesPrototype%*.
178 |
180 | This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.
181 |
188 | When the *supportedLocalesOf* method of *%DisplayNames%* is called, the following steps are taken:
189 |
202 | The value of the [[AvailableLocales]] internal slot is implementation defined within the constraints described in
206 | The value of the [[RelevantExtensionKeys]] internal slot is « ».
207 |
210 | The value of the [[LocaleData]] internal slot is implementation defined within the constraints described in
236 | The Intl.DisplayNames prototype object, referred to as *%DisplayNamesPrototype%*, is itself an ordinary object. It is not a Intl.DisplayNames instance, does not have an [[InitializedDisplayNames]] internal slot or any of the other internal slots of Intl.DisplayNames instance objects.
237 |
243 | The initial value of *Intl.DisplayNames.prototype.constructor* is the intrinsic object *%DisplayNames%*.
244 |
251 | The initial value of the @@toStringTag property is the string value `"Intl.DisplayNames"`.
252 |
254 | This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
255 |
262 | When the *Intl.DisplayNames.prototype.of* is called with an argument _code_, the following steps are taken:
263 |
283 | This function provides access to the locale and options computed during initialization of the object.
284 |
337 | Intl.DisplayNames instances are ordinary objects that inherit properties from %DisplayNamesPrototype%.
338 |
341 | Intl.DisplayNames instances have an [[InitializedDisplayNames]] internal slot.
342 |
345 | Intl.DisplayNames instances also have several internal slots that are computed by the constructor:
346 | DisplayNames Objects
4 |
5 | Abstract Operations for DisplayNames Objects
7 |
8 | CanonicalCodeForDisplayNames ( _type_, _code_)
10 | IsValidDateTimeFieldCode ( _field_ )
44 |
57 |
58 |
112 |
59 |
62 |
63 | Code
60 | Description
61 |
64 |
67 | `"era"`
65 | The field indicating the era, e.g. AD or BC in the Gregorian (Julian) calendar.
66 |
68 |
71 | `"year"`
69 | The field indicating the year.
70 |
72 |
75 | `"quarter"`
73 | The field indicating the quarter, e.g. Q2, 2nd quarter, etc.
74 |
76 |
79 | `"month"`
77 | The field indicating the month, e.g. Sep, September, etc.
78 |
80 |
83 | `"weekOfYear"`
81 | The field indicating the week number within the current year.
82 |
84 |
87 | `"weekday"`
85 | The field indicating the day of week, e.g. Tue, Tuesday, etc.
86 |
88 |
91 | `"day"`
89 | The field indicating the day in month.
90 |
92 |
95 | `"dayPeriod"`
93 | The field indicating the day period, either am/pm marker or others, e.g. noon, evening.
94 |
96 |
99 | `"hour"`
97 | The field indicating the hour.
98 |
100 |
103 | `"minute"`
101 | The field indicating the minute.
102 |
104 |
107 | `"second"`
105 | The field indicating the second.
106 |
108 |
111 | `"timeZoneName"`
109 | The field indicating the time zone name, e.g. PDT, Pacific Daylight Time, etc.
110 | The Intl.DisplayNames Constructor
118 |
119 | Intl.DisplayNames ( _locales_, _options_ )
124 |
125 | Properties of the Intl.DisplayNames Constructor
168 |
169 | Intl.DisplayNames.prototype
175 |
176 | Intl.DisplayNames.supportedLocalesOf ( _locales_ [ , _options_ ] )
186 |
187 | Internal slots
200 |
201 |
214 |
225 |
226 | and `"currency"`, `"calendar"`, and `"dateTimeField"`.`"language"`, `"region"`, `"script"`, and `"currency"`, `"calendar"`, and `"dateTimeField"` must be a Record which must have fields with the names of one of the valid display name styles: `"narrow"`, `"short"`, and `"long"`.Properties of the Intl.DisplayNames Prototype Object
234 |
235 | Intl.DisplayNames.prototype.constructor
241 |
242 | Intl.DisplayNames.prototype[ @@toStringTag ]
249 |
250 | Intl.DisplayNames.prototype.of ( _code_ )
260 |
261 | Intl.DisplayNames.prototype.resolvedOptions ( )
281 |
282 |
302 |
303 |
329 |
304 |
307 |
308 | Internal Slot
305 | Property
306 |
309 |
312 | [[Locale]]
310 | `"locale"`
311 |
313 |
316 | [[Style]]
314 | `"style"`
315 |
317 |
320 | [[Type]]
318 | `"type"`
319 |
321 |
324 | [[Fallback]]
322 | `"fallback"`
323 |
325 |
328 | [[LanguageDisplay]]
326 | `"languageDisplay"`
327 | Properties of Intl.DisplayNames Instances
335 |
336 |
349 |
357 | or `"currency"`, `"calendar"`, or `"dateTimeField"`, identifying the type of the display names requested.and, [[Type]], and [[LanguageDisplay]].
This proposal enhances the Intl.DisplayNames API and cover more display names for weekday, month, time zone, unit, calendar, numbering system, etc. 2249 | See the README for more context.
2250 |2262 | The CanonicalCodeForDisplayNames abstract operation is called with arguments type, code. It verifies that the code argument represents a well-formed code according to the type argument and returns the case-regularized form of the code. The algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar. The following steps are taken: 2263 |
2264 |"language"
, thenunicode_language_id
production, throw a "region"
, thenunicode_region_subtag
production, throw a "script"
, thenunicode_script_subtag
production, throw a "calendar"
, thentype
nonterminal, throw a "dateTimeField"
, then"currency"
.2271 | 2272 | The IsValidDateTimeFieldCode abstract operation is called with argument field. It verifies that the field argument represents a valid date time field code. The following steps are taken: 2273 | 2274 |
2275 |Code | 2283 |Description | 2284 |
---|---|
"era" |
2288 | The field indicating the era, e.g. AD or BC in the Gregorian (Julian) calendar. | 2289 |
"year" |
2292 | The field indicating the year. | 2293 |
"quarter" |
2296 | The field indicating the quarter, e.g. Q2, 2nd quarter, etc. | 2297 |
"month" |
2300 | The field indicating the month, e.g. Sep, September, etc. | 2301 |
"weekOfYear" |
2304 | The field indicating the week number within the current year. | 2305 |
"weekday" |
2308 | The field indicating the day of week, e.g. Tue, Tuesday, etc. | 2309 |
"day" |
2312 | The field indicating the day in month. | 2313 |
"dayPeriod" |
2316 | The field indicating the day period, either am/pm marker or others, e.g. noon, evening. | 2317 |
"hour" |
2320 | The field indicating the hour. | 2321 |
"minute" |
2324 | The field indicating the minute. | 2325 |
"second" |
2328 | The field indicating the second. | 2329 |
"timeZoneName" |
2332 | The field indicating the time zone name, e.g. PDT, Pacific Daylight Time, etc. | 2333 |
2343 | The DisplayNames
2349 | When the
"%DisplayNamesPrototype%"
, « [[InitializedDisplayNames]], [[Locale]], [[Style]], [[Type]], [[Fallback]], [[LanguageDisplay]], [[Fields]] »)."localeMatcher"
, "string"
, « "lookup"
, "best fit"
», "best fit"
)."style"
, "string"
, « "narrow"
, "short"
, "long"
», "long"
)."type"
, "string"
, « "language"
, "region"
, "script"
, "currency"
, "calendar"
, "dateTimeField"
», "fallback"
, "string"
, « "code"
, "none"
», "code"
)."languageDisplay"
, "string"
, « "dialect"
, "standard"
», "dialect"
)."language"
, then
2360 | The Intl.DisplayNames
2367 | The value of
2370 | This property has the attributes { [[Writable]]:
2378 | When the
2388 | The value of the [[AvailableLocales]] internal slot is implementation defined within the constraints described in
2392 | The value of the [[RelevantExtensionKeys]] internal slot is « ». 2393 |
2394 | 2395 |
2396 | The value of the [[LocaleData]] internal slot is implementation defined within the constraints described in
"language"
, "region"
, "script"
, "currency"
, "calendar"
, and "dateTimeField"
."language"
must be a "dialect"
and "standard"
."language"
should contain Records which must have fields with the names of one of the valid display name styles: "narrow"
, "short"
, and "long"
."language"
, "region"
, "script"
, "currency"
, "calendar"
, and "dateTimeField"
must be a "narrow"
, "short"
, and "long"
."language"
should contain Records, with keys corresponding to language codes according to unicode_language_id
production. The value of these fields must be string values."region"
should contain Records, with keys corresponding to region codes. The value of these fields must be string values."script"
should contain Records, with keys corresponding to script codes. The value of these fields must be string values."currency"
should contain Records, with keys corresponding to currency codes. The value of these fields must be string values."calendar"
should contain Records, with keys corresponding to a String value with the type
given in Unicode Technical Standard 35 for the calendar used for formatting. The value of these fields must be string values."dateTimeField"
should contain Records, with keys corresponding to codes listed in
2422 | The Intl.DisplayNames prototype object, referred to as
2429 | The initial value of
2437 | The initial value of the @@toStringTag property is the string value "Intl.DisplayNames"
.
2438 |
2440 | This property has the attributes { [[Writable]]:
2448 | When the
"code"
, return code.2458 | This function provides access to the locale and options computed during initialization of the object. 2459 |
2460 | 2461 |Internal Slot | 2469 |Property | 2470 |
---|---|
[[Locale]] | 2474 |"locale" |
2475 |
[[Style]] | 2478 |"style" |
2479 |
[[Type]] | 2482 |"type" |
2483 |
[[Fallback]] | 2486 |"fallback" |
2487 |
[[LanguageDisplay]] | 2490 |"languageDisplay" |
2491 |
2501 | Intl.DisplayNames instances are ordinary objects that inherit properties from %DisplayNamesPrototype%. 2502 |
2503 | 2504 |2505 | Intl.DisplayNames instances have an [[InitializedDisplayNames]] internal slot. 2506 |
2507 | 2508 |
2509 | Intl.DisplayNames instances also have several internal slots that are computed by the
"narrow"
, "short"
, or "long"
, identifying the display names style used."language"
, "region"
, "script"
, "currency"
, "calendar"
, or "dateTimeField"
, identifying the type of the display names requested."code"
, or "none"
, identifying the fallback return when the system does not have the requested display name."dialect"
or "standard"
, identifying the language display kind. It is only used when [[Type]] has the value "language"
.© 2021 Google, Ecma International
2527 | 2528 |All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
2530 | 2531 |Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2532 | 2533 |THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2540 | 2541 |7 | title: Intl.DisplayNames v2 Proposal 8 | stage: 3 9 | location: https://tc39.es/intl-displaynames-v2/ 10 | copyright: true 11 | contributors: Google, Ecma International 12 |13 | 14 |
This proposal enhances the Intl.DisplayNames API and cover more display names for weekday, month, time zone, unit, calendar, numbering system, etc. 18 | See the README for more context.
19 |