├── .npmrc ├── .gitattributes ├── .github └── workflows │ └── build.yml ├── package.json ├── spec.emu ├── .gitignore ├── LICENSE ├── mock.html ├── biblio.json ├── intl.html ├── README.md ├── locales-currencies-tz.html └── index.html /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "template-for-proposals", 4 | "description": "A repository template for ECMAScript proposals.", 5 | "scripts": { 6 | "start": "npm run build-loose -- --watch", 7 | "build": "npm run build-loose", 8 | "build-loose": "ecmarkup --verbose --load-biblio @tc39/ecma262-biblio spec.emu index.html", 9 | "build-strict": "npm run build-loose -- --lint-spec --strict" 10 | }, 11 | "homepage": "https://github.com/tc39/template-for-proposals#readme", 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/tc39/template-for-proposals.git" 15 | }, 16 | "license": "MIT", 17 | "devDependencies": { 18 | "@tc39/ecma262-biblio": "^2.1.2338", 19 | "ecmarkup": "^14.0.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spec.emu: -------------------------------------------------------------------------------- 1 | 2 | 3 |
 4 | title: Intl Enumeration API Specification
 5 | status: proposal
 6 | stage: 3
 7 | location: https://tc39.github.io/proposal-intl-enumeration
 8 | copyright: true
 9 | contributors: Google, Ecma International
10 | 
11 | 12 | 13 | 14 |

Introduction

15 | 16 |

This proposal adds several function properties to the `Intl Object` to list supported values of options. See the README for more context.

17 |
18 | 19 | 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mock.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 15 | 16 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /biblio.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "location": "https://tc39.es/ecma402/", 4 | "entries": [ 5 | { 6 | "type": "op", 7 | "aoid": "GetOptionsObject", 8 | "id": "sec-getoptionsobject" 9 | }, 10 | { 11 | "type": "op", 12 | "aoid": "GetOption", 13 | "id": "sec-getoption" 14 | }, 15 | { 16 | "type": "op", 17 | "aoid": "CanonicalizeLocaleList", 18 | "id": "sec-canonicalizelocalelist" 19 | }, 20 | { 21 | "type": "op", 22 | "aoid": "UnicodeExtensionComponents", 23 | "id": "sec-unicode-extension-components" 24 | }, 25 | { 26 | "type": "clause", 27 | "number": "10", 28 | "id": "collator-objects" 29 | }, 30 | { 31 | "type": "clause", 32 | "number": "11", 33 | "id": "datetimeformat-objects" 34 | }, 35 | { 36 | "type": "clause", 37 | "number": "12", 38 | "id": "intl-displaynames-objects" 39 | }, 40 | { 41 | "type": "clause", 42 | "number": "13", 43 | "id": "listformat-objects" 44 | }, 45 | { 46 | "type": "clause", 47 | "number": "14", 48 | "id": "locale-objects" 49 | }, 50 | { 51 | "type": "clause", 52 | "number": "15", 53 | "id": "numberformat-objects" 54 | }, 55 | { 56 | "type": "clause", 57 | "number": "16", 58 | "id": "pluralrules-objects" 59 | }, 60 | { 61 | "type": "clause", 62 | "number": "17", 63 | "id": "relativetimeformat-objects" 64 | }, 65 | { 66 | "type": "clause", 67 | "number": "18", 68 | "id": "segmenter-objects" 69 | }, 70 | { 71 | "type": "table", 72 | "number": "2", 73 | "id": "table-sanctioned-simple-unit-identifiers" 74 | }, 75 | { 76 | "type": "table", 77 | "number": "4", 78 | "id": "table-numbering-system-digits" 79 | } 80 | ] 81 | } 82 | ] 83 | -------------------------------------------------------------------------------- /intl.html: -------------------------------------------------------------------------------- 1 | 2 |

The Intl Object

3 |

4 | The Intl object is the %Intl% intrinsic object and the initial value of the *"Intl"* property of the global object. The Intl object is a single ordinary object. 5 |

6 | 7 |

8 | The value of the [[Prototype]] internal slot of the Intl object is the intrinsic object %ObjectPrototype%. 9 |

10 | 11 |

12 | The Intl object is not a function object. It does not have a [[Construct]] internal method; it is not possible to use the Intl object as a constructor with the *new* operator. The Intl object does not have a [[Call]] internal method; it is not possible to invoke the Intl object as a function. 13 |

14 | 15 |

16 | The Intl object has an internal slot, [[FallbackSymbol]], which is a new %Symbol% in the current realm with the [[Description]] *"IntlLegacyConstructedSymbol"*. 17 |

18 | 19 | 20 |

Constructor Properties of the Intl Object

21 | 22 |

23 | With the exception of Intl.Locale, each of the following constructors is a service constructor that creates objects providing locale-sensitive services. 24 |

25 | 26 | 27 |

Intl.Collator ( . . . )

28 |

29 | See . 30 |

31 |
32 | 33 | 34 |

Intl.DateTimeFormat ( . . . )

35 |

36 | See . 37 |

38 |
39 | 40 | 41 |

Intl.DisplayNames ( . . . )

42 |

43 | See . 44 |

45 |
46 | 47 | 48 |

Intl.ListFormat ( . . . )

49 |

50 | See . 51 |

52 |
53 | 54 | 55 |

Intl.Locale ( . . . )

56 |

57 | See . 58 |

59 |
60 | 61 | 62 |

Intl.NumberFormat ( . . . )

63 |

64 | See . 65 |

66 |
67 | 68 | 69 |

Intl.PluralRules ( . . . )

70 |

71 | See . 72 |

73 |
74 | 75 | 76 |

Intl.RelativeTimeFormat ( . . . )

77 |

78 | See . 79 |

80 |
81 | 82 | 83 |

Intl.Segmenter ( . . . )

84 |

85 | See . 86 |

87 |
88 |
89 | 90 | 91 |

Function Properties of the Intl Object

92 | 93 | 94 |

Intl.getCanonicalLocales ( _locales_ )

95 | 96 |

97 | When the `getCanonicalLocales` method is called with argument _locales_, the following steps are taken: 98 |

99 | 100 | 101 | 1. Let _ll_ be ? CanonicalizeLocaleList(_locales_). 102 | 1. Return CreateArrayFromList(_ll_). 103 | 104 |
105 | 106 | 107 | 108 |

Intl.supportedValuesOf ( _key_ )

109 | 110 |

111 | When the `supportedValuesOf` method is called with argument _key_ , the following steps are taken: 112 |

113 | 114 | 115 | 1. Let _key_ be ? ToString(_key_). 116 | 1. If _key_ is *"calendar"*, then 117 | 1. Let _list_ be AvailableCanonicalCalendars( ). 118 | 1. Else if _key_ is *"collation"*, then 119 | 1. Let _list_ be AvailableCanonicalCollations( ). 120 | 1. Else if _key_ is *"currency"*, then 121 | 1. Let _list_ be AvailableCanonicalCurrencies( ). 122 | 1. Else if _key_ is *"numberingSystem"*, then 123 | 1. Let _list_ be AvailableCanonicalNumberingSystems( ). 124 | 1. Else if _key_ is *"timeZone"*, then 125 | 1. Let _list_ be AvailableCanonicalTimeZones( ). 126 | 1. Else if _key_ is *"unit"*, then 127 | 1. Let _list_ be AvailableCanonicalUnits( ). 128 | 1. Else, 129 | 1. Throw a *RangeError* exception. 130 | 1. Return CreateArrayFromList( _list_ ). 131 | 132 |
133 |
134 |
135 |
136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Intl Enumeration API Specification 2 | List supported values of options in pre-existing ECMA 402 API. 3 | 4 | ## Stage 3 5 | * [Advanced to Stage 1 in TC39 June 2020 meeting](https://docs.google.com/presentation/d/17bkiVWuYxhMc24If72d6oENK3G6G-irO2EB4EEQCgxU). 6 | * [2020-06-03 Meeting Notes](https://github.com/tc39/notes/blob/master/meetings/2020-06/june-3.md#intl-enumeration-api-for-stage-1) 7 | * [Advanced to Stage 2 in TC39 September 2020](https://docs.google.com/presentation/d/1IWOHZVkXL_qbjz4T76bXmtLh7VOrWkT-HJIH2ZwY6NU) meeting. 8 | * [2020-09-22 Meeting Notes](https://github.com/tc39/notes/blob/master/meetings/2020-09/sept-22.md#intl-enumeration-api-for-stage-2) 9 | * [Update in TC39 Nov 2020](https://docs.google.com/presentation/d/1t0P8SKpcU9K_h-jYQ6ix5-02_mF1sAKt6v9AzipX3pw) meeting. 10 | * [2020-11-18 Meeting Notes](https://github.com/tc39/notes/blob/master/meetings/2020-11/nov-18.md#intl-enumeration-api-update) 11 | * [Update in TC39 Apr 2021](https://docs.google.com/presentation/d/1LLuJJvGsppQfFf0eCBBcplub_E7NY4EdbSVeE2duyoA) meeting. 12 | * [2021-04-21 Meeting Notes](https://github.com/tc39/notes/blob/master/meetings/2021-04/apr-21.md#intl-enumeration-api-update) 13 | * [Update in TC39 May 2021](https://docs.google.com/presentation/d/1rg5FMmU0vpi--KoxoIZPpNEWxhX-MfBUeoA0y_o94FQ/edit) meeting. 14 | * [2021-05-25 Meeting Notes](https://github.com/tc39/notes/blob/master/meetings/2021-05/may-25.md#intl-enumeration-api-stage-2-update) 15 | * [Advanced Stage 3 advancement in TC39 July 2021](https://docs.google.com/presentation/d/1zL3lb4stb4wrfDlOeMsmW5NqjX_TxTWL5pMjTa1qHVw/edit) meeting 16 | * [2021-07-13 Meeting Notes](https://github.com/tc39/notes/blob/master/meetings/2021-07/july-13.md#intl-enumeration-api-for-stage-3) 17 | * [Update in TC39 Dec 2021](https://docs.google.com/presentation/d/1wR8Yg3JVwa1RAPgQGqUPsRtP0EeMXy_Q8zqgRIKRiQI) meeting. 18 | 19 | ### TG2 (ECMA402) Working Meeting Notes: 20 | * [2020-05-20 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2020-05-21.md#enumeration-of-timezones-435) 21 | * [2020-08-13 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2020-08-13.md#intl-enumeration-api) 22 | * [2020-11-05 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2020-11-05.md#intl-enumeration-api-specification) 23 | * [2021-03-11 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2021-03-11.md#privacy-evaluation-of-the-api-3) 24 | * [2021-04-08 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2021-04-08.md#intl-enumeration-api-privacy-evaluation) 25 | * [2021-05-06 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2021-05-06.md#intl-enumeration-api-for-stage-3) 26 | * [2021-06-03 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2021-06-03.md#remove-region-option-for-timezone) 27 | * [2021-07-01 TG2 Meeting Notes](https://github.com/tc39/ecma402/blob/master/meetings/notes-2021-07-01.md#intl-enumeration-api-for-stage-3) 28 | 29 | ## Need Help! 30 | This proposal is now reaching stage 3, we need help to add tests into [Test262](https://github.com/tc39/test262) now. See [Issue 3131 in test262 for details](https://github.com/tc39/test262/issues/3131). We would also love to see polyfill available to web developers. 31 | ## Motivation 32 | 33 | ECMA402 allows the set of supported local time zones, collations, calendars, numbering systems and currency as implementation dependents. This proposal provides an API to identify the supported values of these options in the implementation. 34 | 35 | The proposed API empower the caller to feature detect the support in the implementation easily and could be used to download polyfill for missing support easily in the beginning of the loading time. For example, a web page could exam the return value and decide it need to import and install a DateTimeFormat polyfill because the return time zones does not contains the server stored user time zone preference and will not be able to use Intl.DateTimeFormat to format the time according to the server side stored time zone preferences. Users may set up their account and store their time zone preferences in the server side while previously using a different user agent which already supports such a time zone and need to use the user agent in another machine in an internet cafe to access the web application. The proposed API allows the web application to do an up front check and import polyfill from server side while the prefered time zone is not available in the user agent. Similarly, the web application may check for the supported set of currency and unit to implement the bootstrap logic of dynamic import polyfill for some javascript library. For example, engineers in Google are currently changing the closure library implementation to use ECMA402 support if the functionality is available to avoid unnecessary data download, but still download the necessary data and import polyfill while the desired support is not available. The proposed API allows the library to determine the logic with a very minimum amount of data. 36 | 37 | Web applications can also combine the use of the proposed API with Intl.DisplayNames and Intl.NumberFormat to build a powerful UI without downloading a lot of data. For example, web applications can use the proposed API to get the list of supported currency, then use Intl.DisplayNames to get back the display name of the currency to build a menu for user to select the calendar, and format the currency amount by using Intl.NumberFormat API. The return value could also support the code to decide which set of the currency conversion information should be downloaded from the server and only download the set of currency the implementation knows how to format correctly, or download all the currency tables and then import polifil to support the one which is not supported. Without the proposed API the web application may either download an extra currency exchange table for currency which won’t be formatted correctly by Intl.NumberFormat and neither be able to efficiently determine which set of currency format data need to be imported with the polyfill. The proposed API empowers the web developer to design an efficient system to import minimum information from the server to implement such a fallback mechanism. 38 | 39 | ECMA 402 is also used on the server side. A server side application code running on top of Node.js, which is built based on v8 and can access ECMA402 code can call the proposed API to generate a list of time zone names known by the server into html and return to the client in a calendar application. 40 | 41 | In summary, the proposed API is an important facility to allow web developers to detect missing support and import fallback polyfills efficiently with a minimum amount of data in the application initialization time. It also allows web application, in conjunction with using other ECMA402 API to program powerful internationalization UI with very minimum information from server side. It is also a vital facility for server side usage of ECMA402. 42 | 43 | 44 | ## Overview 45 | 46 | One method of Intl, return an array. 47 | 48 | ```javascript 49 | Intl.supportedValuesOf(key) 50 | ``` 51 | ### Supported Keys 52 | * calendar 53 | * collation 54 | * currency 55 | * numberingSystem 56 | * timeZone 57 | * unit 58 | 59 | 60 | ## Background 61 | 62 | https://github.com/tc39/ecma402/issues/435 63 | 64 | ## Use case 65 | 66 | ### Use Case 1 - Detect Missing Features to Trigger the Import of Polifill 67 | The user stores their application user preference in the server side to express they want to use the ROC calendar. While the user logs into the application from his new mobile phone, the application code calls this API and found the "roc" calendar is not in the support set, the application imports polyfill from the server side which implements the ROC calendar and uses the polyfill. The user then logs into the application from his desktop, and the application calls this API and found the “roc” calendar is supported, the application therefore just calls the Intl.DateTimeFormat directly. 68 | 69 | ### Use Case 2 - Server Side Programming 70 | The web programmer is programming javascript running on top of Node.js by using ECMA402 code. The application (server side javascript running on top of Node.js) call this API to find out all the support set of calendar, collation, currency, numbering system, and time zone, and unit, and use that to generate UI selector in html and send to the client to let the user to select in their application preference. After the user submits their choice, the server side application stores the user’s application preference into server side storage. The application code (server side javascript running on Node.js) later uses these preference values to output the html to the client. 71 | 72 | ### Use Case 3 - Building Time Zone picker inside WebGL 73 | Developer is working on a video game by using JavaScript to program WebGL and therefore all what users see on the screen is not HTML rendering and everything is 3D in WebGL. The programmer is writing the code to let the character the player control go enter a virtual store and select the currency they like to use to trade the virtual goodie, the programmer therefore need to build a 3D GUI in WebGL which list all the currency Intl.NumberFormat can support to format. A non-existing HTML solution won’t help them even if all the user agents support such a feature in HTML one day. 74 | 75 | 76 | ## Prior Arts 77 | ### Get the List of TimeZone 78 | 79 | * Use Cases: 80 | * [How to get list of all timezones in javascript on Stack Overflow](https://stackoverflow.com/questions/38399465/how-to-get-list-of-all-timezones-in-javascript) 81 | * Prior Arts: 82 | * [momentjs moment.tz.names](https://momentjs.com/timezone/docs/#/data-loading/getting-zone-names/) 83 | * [tzdb](https://github.com/vvo/tzdb/) 84 | * [countries-and-timezones](https://www.npmjs.com/package/countries-and-timezones) 85 | * [country-timezone](https://www.npmjs.com/package/country-timezone) 86 | 87 | ### Get the List of Currency Codes 88 | 89 | * Use Cases: 90 | * [User request on Stack Overflow](https://stackoverflow.com/questions/58029344/get-list-of-supported-currencies) 91 | * Prior Arts: 92 | * [currency-codes](https://www.npmjs.com/package/currency-codes) 93 | * 94 | 95 | 96 | ## Usage example 97 | 98 | 99 | ```javascript 100 | // Find out the supported calendars 101 | Intl.supportedValuesOf("calendar").forEach(function(calendar) { 102 | // 'buddhist', 'chinese', ... 'islamicc' 103 | }); 104 | 105 | // Find out the supported currencies 106 | Intl.supportedValuesOf("currency").forEach(function(currency) { 107 | // 'AED', 'AFN', 'ALL', ... 'ZWL' 108 | }); 109 | 110 | // Find out the supported numbering systems 111 | Intl.supportedValuesOf("numberingSystem").forEach(function(nu) { 112 | // 'adlm', 'ahom', 'arab', ... 'wara', 'wcho' 113 | }); 114 | 115 | // Find out the supported time zones 116 | Intl.supportedValuesOf("timeZone").forEach(function(timeZone) { 117 | // 'Africa/Abidjan', 'Africa/Accra', ... 'Pacific/Wallis' 118 | }); 119 | 120 | // Find out the supported units 121 | Intl.supportedValuesOf("unit").forEach(function(unit) { 122 | // 'acre', 'bit', 'byte', ... 'year' 123 | }); 124 | 125 | ``` 126 | 127 | 128 | ## Authors 129 | * Frank Tang (@FrankYFTang) 130 | 131 | ## Designated reviewers 132 | * Shane Carr @sffc 133 | * Jordan Harband @ljharb 134 | ## ECMAScript editors 135 | * Richard Gibson @gibson042 136 | 137 | ## Proposal 138 | 139 | ### Spec 140 | * https://tc39.es/proposal-intl-enumeration/ 141 | 142 | ## References 143 | ### Analysis of Privacy / Fingerprinting Concerns 144 | * [“Intl.Enumeration Privacy Implications Mozilla’s Recommendation”.](https://docs.google.com/document/d/1Zw6cYNJpL69HtQfA4-S7bKlCPywhhmoF6Mja-qy-JpU), Tom Ritter, Anne van Kesteren, Steven Englehardt, Zibi Braniecki, Mozilla, Feb 4, 2021. 145 | * [Discussion during 2021-03 ECMA402 Meeting](https://github.com/tc39/ecma402/blob/master/meetings/notes-2021-03-11.md#privacy-evaluation-of-the-api-3) 146 | * Duscussion during 2021-04 ECMA402 Meeting (link to be added soon) 147 | 148 | ## Implementation Status 149 | * [v8 tracking bug](https://bugs.chromium.org/p/v8/issues/detail?id=10743) 150 | * Mozilla 151 | * JSC 152 | * Test262 153 | 154 | 155 | 156 | 157 | ============================ Ignore Text Below ============================ 158 | 159 | 160 | #### The following are from the template, will be deleted later 161 | 162 | This repo is setup by following instruction on [TC39 template-for-proposals](https://github.com/tc39/template-for-proposals) 163 | 164 | Your explainer can point readers to the `index.html` generated from `spec.emu` 165 | via markdown like 166 | 167 | ```markdown 168 | You can browse the [ecmarkup output](https://ACCOUNT.github.io/PROJECT/) 169 | or browse the [source](https://github.com/ACCOUNT/PROJECT/blob/master/spec.emu). 170 | ``` 171 | 172 | where *ACCOUNT* and *PROJECT* are the first two path elements in your project's Github URL. 173 | For example, for github.com/**tc39**/**template-for-proposals**, *ACCOUNT* is "tc39" 174 | and *PROJECT* is "template-for-proposals". 175 | 176 | 177 | ## Maintain your proposal repo 178 | 179 | 1. Make your changes to `spec.emu` (ecmarkup uses HTML syntax, but is not HTML, so I strongly suggest not naming it ".html") 180 | 1. Any commit that makes meaningful changes to the spec, should run `npm run build` and commit the resulting output. 181 | 1. Whenever you update `ecmarkup`, run `npm run build` and commit any changes that come from that dependency. 182 | 183 | [explainer]: https://github.com/tc39/how-we-work/blob/master/explainer.md 184 | -------------------------------------------------------------------------------- /locales-currencies-tz.html: -------------------------------------------------------------------------------- 1 | 2 |

Identification of Locales, Currencies, Time Zones, and Measurement Units, Numbering Systems, Collations, and Calendars

3 | 4 |

5 | This clause describes the String values used in the ECMAScript 2023 Internationalization API Specification to identify locales, currencies, time zones, and measurement units, numbering systems, collations, and calendars . 6 |

7 | 8 | 9 |

Case Sensitivity and Case Mapping

10 | 11 |

12 | The String values used to identify locales, currencies, scripts, and time zones are interpreted in an ASCII-case-insensitive manner, treating the code units 0x0041 through 0x005A (corresponding to Unicode characters LATIN CAPITAL LETTER A through LATIN CAPITAL LETTER Z) as equivalent to the corresponding code units 0x0061 through 0x007A (corresponding to Unicode characters LATIN SMALL LETTER A through LATIN SMALL LETTER Z), both inclusive. No other case folding equivalences are applied. 13 |

14 | 15 | For example, *"ß"* (U+00DF) must not match or be mapped to *"SS"* (U+0053, U+0053). *"ı"* (U+0131) must not match or be mapped to *"I"* (U+0049). 16 | 17 |

18 | The ASCII-uppercase of a String value _S_ is the String value derived from _S_ by replacing each occurrence of an ASCII lowercase letter code unit (0x0061 through 0x007A, inclusive) with the corresponding ASCII uppercase letter code unit (0x0041 through 0x005A, inclusive) while preserving all other code units. 19 |

20 |

21 | The ASCII-lowercase of a String value _S_ is the String value derived from _S_ by replacing each occurrence of an ASCII uppercase letter code unit (0x0041 through 0x005A, inclusive) with the corresponding ASCII lowercase letter code unit (0x0061 through 0x007A, inclusive) while preserving all other code units. 22 |

23 |

24 | A String value _A_ is an ASCII-case-insensitive match for String value _B_ if the ASCII-uppercase of _A_ is exactly the same sequence of code units as the ASCII-uppercase of _B_. A sequence of Unicode code points _A_ is an ASCII-case-insensitive match for _B_ if _B_ is an ASCII-case-insensitive match for ! CodePointsToString(_A_). 25 |

26 |
27 | 28 | 29 |

Language Tags

30 |

...

31 |
32 | 33 | 34 |

Currency Codes

35 | 36 |

37 | The ECMAScript 2023 Internationalization API Specification identifies currencies using 3-letter currency codes as defined by ISO 4217. Their canonical form is uppercase. 38 |

39 | 40 |

41 | All well-formed 3-letter ISO 4217 currency codes are allowed. However, the set of combinations of currency code and language tag for which localized currency symbols are available is implementation dependent. Where a localized currency symbol is not available, the ISO 4217 currency code is used for formatting. 42 |

43 | 44 | 45 |

IsWellFormedCurrencyCode ( _currency_ )

46 | 47 |

48 | The IsWellFormedCurrencyCode abstract operation verifies that the _currency_ argument (which must be a String value) represents a well-formed 3-letter ISO currency code. The following steps are taken: 49 |

50 | 51 | 52 | 1. If the length of _currency_ is not 3, return *false*. 53 | 1. Let _normalized_ be the ASCII-uppercase of _currency_. 54 | 1. If _normalized_ contains any code unit outside of 0x0041 through 0x005A (corresponding to Unicode characters LATIN CAPITAL LETTER A through LATIN CAPITAL LETTER Z), return *false*. 55 | 1. Return *true*. 56 | 57 |
58 | 59 | 60 | 61 |

AvailableCanonicalCurrencies ( 62 | ): a List of Strings

63 |
64 |
description
65 |
The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique, well-formed, and upper case canonicalized 3-letter ISO 4217 currency codes, identifying the currencies for which the implementation provides the functionality of Intl.DisplayNames and Intl.NumberFormat objects.
66 |
67 |
68 |
69 |
70 | 71 | 72 |

Time Zone Names

73 | 74 |

75 | The ECMAScript 2023 Internationalization API Specification identifies time zones using the Zone and Link names of the IANA Time Zone Database. Their canonical form is the corresponding Zone name in the casing used in the IANA Time Zone Database except as specifically overridden by CanonicalizeTimeZoneName. 76 |

77 | 78 |

79 | A conforming implementation must recognize *"UTC"* and all other Zone and Link names (and only such names), and use best available current and historical information about their offsets from UTC and their daylight saving time rules in calculations. However, the set of combinations of time zone name and language tag for which localized time zone names are available is implementation dependent. 80 |

81 | 82 | 83 |

IsValidTimeZoneName ( _timeZone_ )

84 | 85 |

86 | The abstract operation IsValidTimeZoneName takes argument _timeZone_, a String value, and verifies that it represents a valid Zone or Link name of the IANA Time Zone Database. 87 |

88 | 89 | 90 | 1. If one of the Zone or Link names of the IANA Time Zone Database is an ASCII-case-insensitive match of _timeZone_, return *true*. 91 | 1. If _timeZone_ is an ASCII-case-insensitive match of *"UTC"*, return *true*. 92 | 1. Return *false*. 93 | 94 |
95 | 96 | 97 | Any value returned from DefaultTimeZone must be recognized as valid. 98 | 99 | 100 | 101 |

102 | CanonicalizeTimeZoneName ( 103 | _timeZone_: a String value that is a valid time zone name as verified by IsValidTimeZoneName, 104 | ) 105 |

106 |
107 |
description
108 |
It returns the canonical and case-regularized form of _timeZone_.
109 |
110 | 111 | 1. Let _ianaTimeZone_ be the String value of the Zone or Link name of the IANA Time Zone Database that is an ASCII-case-insensitive match of _timeZone_. 112 | 1. If _ianaTimeZone_ is a Link name, let _ianaTimeZone_ be the String value of the corresponding Zone name as specified in the file backward of the IANA Time Zone Database. 113 | 1. If _ianaTimeZone_ is *"Etc/UTC"* or *"Etc/GMT"*, return *"UTC"*. 114 | 1. Return _ianaTimeZone_. 115 | 116 |
117 | 118 | 119 |

DefaultTimeZone ( )

120 | 121 |

122 | The DefaultTimeZone abstract operation returns a String value representing the valid () and canonicalized () time zone name for the host environment's current time zone. 123 |

124 |
125 | 126 | 127 | 128 |

129 | AvailableCanonicalTimeZones ( 130 | ): a List of Strings 131 |

132 |
133 |
description
134 |
The returned List is a sorted List of supported Zone and Link names in the IANA Time Zone Database.
135 |
136 | 137 | 138 | 1. Let _names_ be a List of all supported Zone and Link names in the IANA Time Zone Database. 139 | 1. Let _result_ be a new empty List. 140 | 1. For each element _name_ of _names_, do 141 | 1. Assert: ! IsValidTimeZoneName( _name_ ) is *true*. 142 | 1. Let _canonical_ be ! CanonicalizeTimeZoneName( _name_ ). 143 | 1. If _result_ does not contain an element equal to _canonical_, then 144 | 1. Append _canonical_ to the end of _result_. 145 | 1. Sort _result_ in order as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_. 146 | 1. Return _result_. 147 | 148 |
149 |
150 |
151 | 152 | 153 |

Measurement Unit Identifiers

154 | 155 |

156 | The ECMAScript 2023 Internationalization API Specification identifies measurement units using a core unit identifier (or equivalently core unit ID) as defined by Unicode Technical Standard #35, Part 2, Section 6.2. Their canonical form is a string containing only Unicode Basic Latin lowercase letters (U+0061 LATIN SMALL LETTER A through U+007A LATIN SMALL LETTER Z) with zero or more medial hyphens (U+002D HYPHEN-MINUS). 157 |

158 | 159 |

160 | Only a limited set of core unit identifiers are sanctioned. 161 | Attempting to use an unsanctioned core unit identifier results in a RangeError. 162 |

163 | 164 | 165 |

IsWellFormedUnitIdentifier ( _unitIdentifier_ )

166 | 167 |

168 | The IsWellFormedUnitIdentifier abstract operation verifies that the _unitIdentifier_ argument (which must be a String value) represents a well-formed UTS #35 core unit identifier that is either a sanctioned single unit or a complex unit formed by division of two sanctioned single units. The following steps are taken: 169 |

170 | 171 | 172 | 1. If ! IsSanctionedSingleUnitIdentifier(_unitIdentifier_) is *true*, then 173 | 1. Return *true*. 174 | 1. Let _i_ be StringIndexOf(_unitIdentifier_, *"-per-"*, 0). 175 | 1. If _i_ is -1 or StringIndexOf(_unitIdentifier_, *"-per-"*, _i_ + 1) is not -1, then 176 | 1. Return *false*. 177 | 1. Assert: The five-character substring *"-per-"* occurs exactly once in _unitIdentifier_, at index _i_. 178 | 1. Let _numerator_ be the substring of _unitIdentifier_ from 0 to _i_. 179 | 1. Let _denominator_ be the substring of _unitIdentifier_ from _i_ + 5. 180 | 1. If ! IsSanctionedSingleUnitIdentifier(_numerator_) and ! IsSanctionedSingleUnitIdentifier(_denominator_) are both *true*, then 181 | 1. Return *true*. 182 | 1. Return *false*. 183 | 184 |
185 | 186 | 187 |

IsSanctionedSingleUnitIdentifier ( _unitIdentifier_ )

188 | 189 |

190 | The IsSanctionedSingleUnitIdentifier abstract operation verifies that the _unitIdentifier_ argument (which must be a String value) is among the single unit identifiers sanctioned in the current version of the ECMAScript Internationalization API Specification, which are a subset of the Common Locale Data Repository release 38 unit validity data; the list may grow over time. As discussed in UTS #35, a single unit identifier is a core unit identifier that is not composed of multiplication or division of other unit identifiers. The following steps are taken: 191 |

192 | 193 | 194 | 1. If _unitIdentifier_ is listed in below, return *true*. 195 | 1. Else, return *false*. 196 | 197 | 198 | 199 | Single units sanctioned for use in ECMAScript 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 |
Single Unit Identifier
acre
bit
byte
celsius
centimeter
day
degree
fahrenheit
fluid-ounce
foot
gallon
gigabit
gigabyte
gram
hectare
hour
inch
kilobit
kilobyte
kilogram
kilometer
liter
megabit
megabyte
meter
mile
mile-scandinavian
milliliter
millimeter
millisecond
minute
month
ounce
percent
petabyte
pound
second
stone
terabit
terabyte
week
yard
year
250 |
251 |
252 | 253 | 254 | 255 |

AvailableCanonicalUnits ( 256 | ): a List of Strings

257 |
258 |
description
259 |
The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and consists of the unique values of simple unit identifiers listed in every row of , except the header row.
260 |
261 |
262 |
263 |
264 | 265 | 266 | 267 |

Numbering System Identifiers

268 | 269 |

270 | The ECMAScript 2023 Internationalization API Specification identifies numbering systems using a numbering system identifier as defined by Unicode Technical Standard #35, Part 3, Section 1. Their canonical form is a string containing all lowercase letters. 271 |

272 | 273 | 274 |

AvailableCanonicalNumberingSystems ( 275 | ): a List of Strings

276 |
277 |
description
278 |
The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique numbering systems identifiers identifying the canonical numbering systems for which the implementation provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and Intl.RelativeTimeFormat objects. The list must include the Numbering System value of every row of , except the header row.
279 |
280 |
281 |
282 | 283 | 284 |

Collation Types

285 | 286 |

287 | The ECMAScript 2023 Internationalization API Specification identifies collations using a collation type as defined by Unicode Technical Standard #35, Part 5, Section 3.1. Their canonical form is a string containing all lowercase letters with zero or more hyphens. 288 |

289 | 290 | 291 |

AvailableCanonicalCollations ( 292 | ): a List of Strings

293 |
294 |
description
295 |
The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique canonical collation types identifying the collations for which the implementation provides the functionality of Intl.Collator objects.
296 |
297 |
298 |
299 | 300 | 301 |

Calendar Types

302 | 303 |

304 | The ECMAScript 2023 Internationalization API Specification identifies calendars using a calendar type as defined by Unicode Technical Standard #35, Part 4, Section 2. Their canonical form is a string containing all lower case letters with zero or more hyphens. 305 |

306 | 307 | 308 |

AvailableCanonicalCalendars ( 309 | ): a List of Strings

310 |
311 |
description
312 |
The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique canonical calendar types identifying the calendars for which the implementation provides the functionality of Intl.DateTimeFormat objects. The list must include *"iso8601"*.
313 |
314 |
315 |
316 |
317 |
318 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Intl Enumeration API Specification
2517 |

Stage 3 Draft / November 3, 2022

Intl Enumeration API Specification

2526 | 2527 | 2528 | 2529 |

Introduction

2530 | 2531 |

This proposal adds several function properties to the Intl Object to list supported values of options. See the README for more context.

2532 |
2533 | 2534 |

1 Identification of Locales, Currencies, Time Zones, and Measurement Units, Numbering Systems, Collations, and Calendars

2535 | 2536 |

2537 | This clause describes the String values used in the ECMAScript 2023 Internationalization API Specification to identify locales, currencies, time zones, and measurement units, numbering systems, collations, and calendars . 2538 |

2539 | 2540 | 2541 |

1.1 Case Sensitivity and Case Mapping

2542 | 2543 |

2544 | The String values used to identify locales, currencies, scripts, and time zones are interpreted in an ASCII-case-insensitive manner, treating the code units 0x0041 through 0x005A (corresponding to Unicode characters LATIN CAPITAL LETTER A through LATIN CAPITAL LETTER Z) as equivalent to the corresponding code units 0x0061 through 0x007A (corresponding to Unicode characters LATIN SMALL LETTER A through LATIN SMALL LETTER Z), both inclusive. No other case folding equivalences are applied. 2545 |

2546 | Note
2547 | For example, "ß" (U+00DF) must not match or be mapped to "SS" (U+0053, U+0053). "ı" (U+0131) must not match or be mapped to "I" (U+0049). 2548 |
2549 |

2550 | The ASCII-uppercase of a String value S is the String value derived from S by replacing each occurrence of an ASCII lowercase letter code unit (0x0061 through 0x007A, inclusive) with the corresponding ASCII uppercase letter code unit (0x0041 through 0x005A, inclusive) while preserving all other code units. 2551 |

2552 |

2553 | The ASCII-lowercase of a String value S is the String value derived from S by replacing each occurrence of an ASCII uppercase letter code unit (0x0041 through 0x005A, inclusive) with the corresponding ASCII lowercase letter code unit (0x0061 through 0x007A, inclusive) while preserving all other code units. 2554 |

2555 |

2556 | A String value A is an ASCII-case-insensitive match for String value B if the ASCII-uppercase of A is exactly the same sequence of code units as the ASCII-uppercase of B. A sequence of Unicode code points A is an ASCII-case-insensitive match for B if B is an ASCII-case-insensitive match for ! CodePointsToString(A). 2557 |

2558 |
2559 | 2560 | 2561 |

1.2 Language Tags

2562 |

...

2563 |
2564 | 2565 | 2566 |

1.3 Currency Codes

2567 | 2568 |

2569 | The ECMAScript 2023 Internationalization API Specification identifies currencies using 3-letter currency codes as defined by ISO 4217. Their canonical form is uppercase. 2570 |

2571 | 2572 |

2573 | All well-formed 3-letter ISO 4217 currency codes are allowed. However, the set of combinations of currency code and language tag for which localized currency symbols are available is implementation dependent. Where a localized currency symbol is not available, the ISO 4217 currency code is used for formatting. 2574 |

2575 | 2576 | 2577 |

1.3.1 IsWellFormedCurrencyCode ( currency )

2578 | 2579 |

2580 | The IsWellFormedCurrencyCode abstract operation verifies that the currency argument (which must be a String value) represents a well-formed 3-letter ISO currency code. The following steps are taken: 2581 |

2582 | 2583 |
  1. If the length of currency is not 3, return false.
  2. Let normalized be the ASCII-uppercase of currency.
  3. If normalized contains any code unit outside of 0x0041 through 0x005A (corresponding to Unicode characters LATIN CAPITAL LETTER A through LATIN CAPITAL LETTER Z), return false.
  4. Return true.
2584 |
2585 | 2586 | 2587 | 2588 |

1.3.2 AvailableCanonicalCurrencies ( )

2589 |

The implementation-defined abstract operation AvailableCanonicalCurrencies takes no arguments and returns a List of Strings. The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn, and contains unique, well-formed, and upper case canonicalized 3-letter ISO 4217 currency codes, identifying the currencies for which the implementation provides the functionality of Intl.DisplayNames and Intl.NumberFormat objects.

2590 |
2591 |
2592 |
2593 | 2594 | 2595 |

1.4 Time Zone Names

2596 | 2597 |

2598 | The ECMAScript 2023 Internationalization API Specification identifies time zones using the Zone and Link names of the IANA Time Zone Database. Their canonical form is the corresponding Zone name in the casing used in the IANA Time Zone Database except as specifically overridden by CanonicalizeTimeZoneName. 2599 |

2600 | 2601 |

2602 | A conforming implementation must recognize "UTC" and all other Zone and Link names (and only such names), and use best available current and historical information about their offsets from UTC and their daylight saving time rules in calculations. However, the set of combinations of time zone name and language tag for which localized time zone names are available is implementation dependent. 2603 |

2604 | 2605 | 2606 |

1.4.1 IsValidTimeZoneName ( timeZone )

2607 | 2608 |

2609 | The abstract operation IsValidTimeZoneName takes argument timeZone, a String value, and verifies that it represents a valid Zone or Link name of the IANA Time Zone Database. 2610 |

2611 | 2612 |
  1. If one of the Zone or Link names of the IANA Time Zone Database is an ASCII-case-insensitive match of timeZone, return true.
  2. If timeZone is an ASCII-case-insensitive match of "UTC", return true.
  3. Return false.
2613 |
2614 | 2615 | Note
2616 | Any value returned from DefaultTimeZone must be recognized as valid. 2617 |
2618 | 2619 | 2620 |

1.4.2 CanonicalizeTimeZoneName ( timeZone )

2621 |

The abstract operation CanonicalizeTimeZoneName takes argument timeZone (a String value that is a valid time zone name as verified by IsValidTimeZoneName). It returns the canonical and case-regularized form of timeZone. It performs the following steps when called:

2622 |
  1. Let ianaTimeZone be the String value of the Zone or Link name of the IANA Time Zone Database that is an ASCII-case-insensitive match of timeZone.
  2. If ianaTimeZone is a Link name, let ianaTimeZone be the String value of the corresponding Zone name as specified in the file backward of the IANA Time Zone Database.
  3. If ianaTimeZone is "Etc/UTC" or "Etc/GMT", return "UTC".
  4. Return ianaTimeZone.
2623 |
2624 | 2625 | 2626 |

1.4.3 DefaultTimeZone ( )

2627 | 2628 |

2629 | The DefaultTimeZone abstract operation returns a String value representing the valid (1.4.1) and canonicalized (1.4.2) time zone name for the host environment's current time zone. 2630 |

2631 |
2632 | 2633 | 2634 | 2635 |

1.4.4 AvailableCanonicalTimeZones ( )

2636 |

The implementation-defined abstract operation AvailableCanonicalTimeZones takes no arguments and returns a List of Strings. The returned List is a sorted List of supported Zone and Link names in the IANA Time Zone Database. It performs the following steps when called:

2637 | 2638 |
  1. Let names be a List of all supported Zone and Link names in the IANA Time Zone Database.
  2. Let result be a new empty List.
  3. For each element name of names, do
    1. Assert: ! IsValidTimeZoneName( name ) is true.
    2. Let canonical be ! CanonicalizeTimeZoneName( name ).
    3. If result does not contain an element equal to canonical, then
      1. Append canonical to the end of result.
  4. Sort result in order as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn.
  5. Return result.
2639 |
2640 |
2641 |
2642 | 2643 | 2644 |

1.5 Measurement Unit Identifiers

2645 | 2646 |

2647 | The ECMAScript 2023 Internationalization API Specification identifies measurement units using a core unit identifier (or equivalently core unit ID) as defined by Unicode Technical Standard #35, Part 2, Section 6.2. Their canonical form is a string containing only Unicode Basic Latin lowercase letters (U+0061 LATIN SMALL LETTER A through U+007A LATIN SMALL LETTER Z) with zero or more medial hyphens (U+002D HYPHEN-MINUS). 2648 |

2649 | 2650 |

2651 | Only a limited set of core unit identifiers are sanctioned. 2652 | Attempting to use an unsanctioned core unit identifier results in a RangeError. 2653 |

2654 | 2655 | 2656 |

1.5.1 IsWellFormedUnitIdentifier ( unitIdentifier )

2657 | 2658 |

2659 | The IsWellFormedUnitIdentifier abstract operation verifies that the unitIdentifier argument (which must be a String value) represents a well-formed UTS #35 core unit identifier that is either a sanctioned single unit or a complex unit formed by division of two sanctioned single units. The following steps are taken: 2660 |

2661 | 2662 |
  1. If ! IsSanctionedSingleUnitIdentifier(unitIdentifier) is true, then
    1. Return true.
  2. Let i be StringIndexOf(unitIdentifier, "-per-", 0).
  3. If i is -1 or StringIndexOf(unitIdentifier, "-per-", i + 1) is not -1, then
    1. Return false.
  4. Assert: The five-character substring "-per-" occurs exactly once in unitIdentifier, at index i.
  5. Let numerator be the substring of unitIdentifier from 0 to i.
  6. Let denominator be the substring of unitIdentifier from i + 5.
  7. If ! IsSanctionedSingleUnitIdentifier(numerator) and ! IsSanctionedSingleUnitIdentifier(denominator) are both true, then
    1. Return true.
  8. Return false.
2663 |
2664 | 2665 | 2666 |

1.5.2 IsSanctionedSingleUnitIdentifier ( unitIdentifier )

2667 | 2668 |

2669 | The IsSanctionedSingleUnitIdentifier abstract operation verifies that the unitIdentifier argument (which must be a String value) is among the single unit identifiers sanctioned in the current version of the ECMAScript Internationalization API Specification, which are a subset of the Common Locale Data Repository release 38 unit validity data; the list may grow over time. As discussed in UTS #35, a single unit identifier is a core unit identifier that is not composed of multiplication or division of other unit identifiers. The following steps are taken: 2670 |

2671 | 2672 |
  1. If unitIdentifier is listed in Table 1 below, return true.
  2. Else, return false.
2673 | 2674 |
Table 1: Single units sanctioned for use in ECMAScript
2675 | 2676 | 2677 | 2678 | 2679 | 2680 | 2681 | 2682 | 2683 | 2684 | 2685 | 2686 | 2687 | 2688 | 2689 | 2690 | 2691 | 2692 | 2693 | 2694 | 2695 | 2696 | 2697 | 2698 | 2699 | 2700 | 2701 | 2702 | 2703 | 2704 | 2705 | 2706 | 2707 | 2708 | 2709 | 2710 | 2711 | 2712 | 2713 | 2714 | 2715 | 2716 | 2717 | 2718 | 2719 | 2720 | 2721 | 2722 | 2723 | 2724 | 2725 |
Single Unit Identifier
acre
bit
byte
celsius
centimeter
day
degree
fahrenheit
fluid-ounce
foot
gallon
gigabit
gigabyte
gram
hectare
hour
inch
kilobit
kilobyte
kilogram
kilometer
liter
megabit
megabyte
meter
mile
mile-scandinavian
milliliter
millimeter
millisecond
minute
month
ounce
percent
petabyte
pound
second
stone
terabit
terabyte
week
yard
year
2726 |
2727 |
2728 | 2729 | 2730 | 2731 |

1.5.3 AvailableCanonicalUnits ( )

2732 |

The abstract operation AvailableCanonicalUnits takes no arguments and returns a List of Strings. The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn, and consists of the unique values of simple unit identifiers listed in every row of Table 2, except the header row.

2733 |
2734 |
2735 |
2736 | 2737 | 2738 | 2739 |

1.6 Numbering System Identifiers

2740 | 2741 |

2742 | The ECMAScript 2023 Internationalization API Specification identifies numbering systems using a numbering system identifier as defined by Unicode Technical Standard #35, Part 3, Section 1. Their canonical form is a string containing all lowercase letters. 2743 |

2744 | 2745 | 2746 |

1.6.1 AvailableCanonicalNumberingSystems ( )

2747 |

The implementation-defined abstract operation AvailableCanonicalNumberingSystems takes no arguments and returns a List of Strings. The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn, and contains unique numbering systems identifiers identifying the canonical numbering systems for which the implementation provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and Intl.RelativeTimeFormat objects. The list must include the Numbering System value of every row of Table 4, except the header row.

2748 |
2749 |
2750 | 2751 | 2752 |

1.7 Collation Types

2753 | 2754 |

2755 | The ECMAScript 2023 Internationalization API Specification identifies collations using a collation type as defined by Unicode Technical Standard #35, Part 5, Section 3.1. Their canonical form is a string containing all lowercase letters with zero or more hyphens. 2756 |

2757 | 2758 | 2759 |

1.7.1 AvailableCanonicalCollations ( )

2760 |

The implementation-defined abstract operation AvailableCanonicalCollations takes no arguments and returns a List of Strings. The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn, and contains unique canonical collation types identifying the collations for which the implementation provides the functionality of Intl.Collator objects.

2761 |
2762 |
2763 | 2764 | 2765 |

1.8 Calendar Types

2766 | 2767 |

2768 | The ECMAScript 2023 Internationalization API Specification identifies calendars using a calendar type as defined by Unicode Technical Standard #35, Part 4, Section 2. Their canonical form is a string containing all lower case letters with zero or more hyphens. 2769 |

2770 | 2771 | 2772 |

1.8.1 AvailableCanonicalCalendars ( )

2773 |

The implementation-defined abstract operation AvailableCanonicalCalendars takes no arguments and returns a List of Strings. The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn, and contains unique canonical calendar types identifying the calendars for which the implementation provides the functionality of Intl.DateTimeFormat objects. The list must include "iso8601".

2774 |
2775 |
2776 |
2777 |
2778 | 2779 |

2 The Intl Object

2780 |

2781 | The Intl object is the %Intl% intrinsic object and the initial value of the "Intl" property of the global object. The Intl object is a single ordinary object. 2782 |

2783 | 2784 |

2785 | The value of the [[Prototype]] internal slot of the Intl object is the intrinsic object %ObjectPrototype%. 2786 |

2787 | 2788 |

2789 | The Intl object is not a function object. It does not have a [[Construct]] internal method; it is not possible to use the Intl object as a constructor with the new operator. The Intl object does not have a [[Call]] internal method; it is not possible to invoke the Intl object as a function. 2790 |

2791 | 2792 |

2793 | The Intl object has an internal slot, [[FallbackSymbol]], which is a new %Symbol% in the current realm with the [[Description]] "IntlLegacyConstructedSymbol". 2794 |

2795 | 2796 | 2797 |

2.1 Constructor Properties of the Intl Object

2798 | 2799 |

2800 | With the exception of Intl.Locale, each of the following constructors is a service constructor that creates objects providing locale-sensitive services. 2801 |

2802 | 2803 | 2804 |

2.1.1 Intl.Collator ( . . . )

2805 |

2806 | See 10. 2807 |

2808 |
2809 | 2810 | 2811 |

2.1.2 Intl.DateTimeFormat ( . . . )

2812 |

2813 | See 11. 2814 |

2815 |
2816 | 2817 | 2818 |

2.1.3 Intl.DisplayNames ( . . . )

2819 |

2820 | See 12. 2821 |

2822 |
2823 | 2824 | 2825 |

2.1.4 Intl.ListFormat ( . . . )

2826 |

2827 | See 13. 2828 |

2829 |
2830 | 2831 | 2832 |

2.1.5 Intl.Locale ( . . . )

2833 |

2834 | See 14. 2835 |

2836 |
2837 | 2838 | 2839 |

2.1.6 Intl.NumberFormat ( . . . )

2840 |

2841 | See 15. 2842 |

2843 |
2844 | 2845 | 2846 |

2.1.7 Intl.PluralRules ( . . . )

2847 |

2848 | See 16. 2849 |

2850 |
2851 | 2852 | 2853 |

2.1.8 Intl.RelativeTimeFormat ( . . . )

2854 |

2855 | See 17. 2856 |

2857 |
2858 | 2859 | 2860 |

2.1.9 Intl.Segmenter ( . . . )

2861 |

2862 | See 18. 2863 |

2864 |
2865 |
2866 | 2867 | 2868 |

2.2 Function Properties of the Intl Object

2869 | 2870 | 2871 |

2.2.1 Intl.getCanonicalLocales ( locales )

2872 | 2873 |

2874 | When the getCanonicalLocales method is called with argument locales, the following steps are taken: 2875 |

2876 | 2877 |
  1. Let ll be ? CanonicalizeLocaleList(locales).
  2. Return CreateArrayFromList(ll).
2878 |
2879 | 2880 | 2881 | 2882 |

2.2.2 Intl.supportedValuesOf ( key )

2883 | 2884 |

2885 | When the supportedValuesOf method is called with argument key , the following steps are taken: 2886 |

2887 | 2888 |
  1. Let key be ? ToString(key).
  2. If key is "calendar", then
    1. Let list be AvailableCanonicalCalendars( ).
  3. Else if key is "collation", then
    1. Let list be AvailableCanonicalCollations( ).
  4. Else if key is "currency", then
    1. Let list be AvailableCanonicalCurrencies( ).
  5. Else if key is "numberingSystem", then
    1. Let list be AvailableCanonicalNumberingSystems( ).
  6. Else if key is "timeZone", then
    1. Let list be AvailableCanonicalTimeZones( ).
  7. Else if key is "unit", then
    1. Let list be AvailableCanonicalUnits( ).
  8. Else,
    1. Throw a RangeError exception.
  9. Return CreateArrayFromList( list ).
2889 |
2890 |
2891 |
2892 |
2893 |

A Copyright & Software License

2894 | 2895 |

Copyright Notice

2896 |

© 2022 Google, Ecma International

2897 | 2898 |

Software License

2899 |

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.

2900 | 2901 |

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

2902 | 2903 |
    2904 |
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. 2905 |
  3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  4. 2906 |
  5. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.
  6. 2907 |
2908 | 2909 |

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.

2910 | 2911 |
2912 |
--------------------------------------------------------------------------------