|
109 | 109 | let constructor
|
110 | 110 | if ('collator' == k) {constructor = Intl.Collator(code).resolvedOptions()
|
111 | 111 | } else if ('datetimeformat' == k) {constructor = Intl.DateTimeFormat(code).resolvedOptions()
|
| 112 | + } else if ('durationformat' == k) {constructor = new Intl.DurationFormat(code).resolvedOptions() |
| 113 | + } else if ('listformat' == k) {constructor = new Intl.ListFormat(code).resolvedOptions() |
112 | 114 | } else if ('numberformat' == k) {constructor = new Intl.NumberFormat(code).resolvedOptions()
|
113 | 115 | } else if ('pluralrules' == k) {constructor = new Intl.PluralRules(code).resolvedOptions()
|
114 | 116 | } else if ('relativetimeformat' == k) {constructor = new Intl.RelativeTimeFormat(code).resolvedOptions()
|
|
145 | 147 | let oMax = {
|
146 | 148 | 'collator': ['caseFirst','collation','ignorePunctuation','numeric','sensitivity','usage'],
|
147 | 149 | "datetimeformat": ['calendar','day','hourcycle','month','numberingSystem','year'],
|
| 150 | + /* NOTE: displaynames: https://tc39.es/ecma402/#intl-displaynames-objects |
| 151 | + - four types: currency, language, region, script |
| 152 | + - e.g. new Intl.DisplayNames(code, {type: 'language'}).resolvedOptions() |
| 153 | + - second options parameter |
| 154 | + - fallback: default is code |
| 155 | + - style: default is long |
| 156 | + - languageDisplay (for use with type 'language'): default is dialect |
| 157 | + - so nothing is gained here as all codes are indentical |
| 158 | + - but we can use this API to get results per locale using 'of' e.g. |
| 159 | + > let l = new Intl.DisplayNames(code, {type: 'language'}).resolvedOptions() |
| 160 | + > s.of('en-US') = "American English" // code: en-US |
| 161 | + > s.of('en-US') = "anglais américain" // code: fr |
| 162 | + > and we can of course pass undefined as the code |
| 163 | + */ |
| 164 | + 'durationformat': [ // creates 10 buckets on it's own |
| 165 | + 'days','daysDisplay','hours','hoursDisplay','microseconds','microsecondsDisplay', |
| 166 | + 'milliseconds','millisecondsDisplay','minutes','minutesDisplay','months','monthsDisplay', |
| 167 | + 'nanoseconds','nanosecondsDisplay','numberingSystem','seconds','secondsDisplay', |
| 168 | + 'style','weeks','weeksDisplay','years','yearsDisplay' |
| 169 | + ], |
| 170 | + /* listformat: https://tc39.es/ecma402/#listformat-objects |
| 171 | + - options are defaults |
| 172 | + - style = long, type = conjunction |
| 173 | + - i.e user must set them |
| 174 | + */ |
148 | 175 | 'numberformat': [
|
149 | 176 | 'maximumFractionDigits','minimumFractionDigits','minimumIntegerDigits',
|
150 | 177 | 'roundingIncrement','roundingMode','roundingPriority','trailingZeroDisplay',
|
151 |
| - 'notation','numberingSystem','signDisplay','style','useGrouping' |
| 178 | + 'notation','numberingSystem','signDisplay','style','useGrouping', |
152 | 179 | ],
|
153 | 180 | 'pluralrules': [
|
154 | 181 | 'maximumFractionDigits','minimumFractionDigits','minimumIntegerDigits','pluralCategories',
|
155 | 182 | 'roundingIncrement','roundingMode','roundingPriority','trailingZeroDisplay','type'
|
156 | 183 | ],
|
157 |
| - 'relativetimeformat': ['numberingSystem','nnumeric','style'], |
| 184 | + 'relativetimeformat': ['numberingSystem','numeric','style'], |
158 | 185 | 'segmenter': ['granularity'],
|
159 | 186 | }
|
160 | 187 |
|
|
222 | 249 | // notate new if 128+
|
223 | 250 | if (isVer > 127) {
|
224 | 251 | // results
|
225 |
| - if (resultsHash == "d2088ade") { //FF134+ |
226 |
| - } else if (resultsHash == "422c656d") { // FF128-133 |
| 252 | + if (resultsHash == "5d643afe") { // FF134+ with Intl.DurationFormat enabled |
| 253 | + } else if (resultsHash == "4e1cb92a") { // FF134+ without Intl.DurationFormat |
| 254 | + } else if (resultsHash == "d39ce60e") { // FF128-133 |
227 | 255 | } else {resultsHash += ' '+ zNEW
|
228 | 256 | }
|
229 | 257 | // locales
|
|
292 | 320 | ]
|
293 | 321 | list = list.concat(aListExtra)
|
294 | 322 | list = list.filter(function(item, position) {return list.indexOf(item) === position})
|
| 323 | + //list = ["en,english"] |
295 | 324 | legend()
|
296 | 325 | setBtn("all")
|
297 | 326 | setTimeout(function() {
|
|
0 commit comments