@formatjs/intl-locale 5.1.2 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendars.generated.d.ts +0 -2
- package/character-orders.generated.d.ts +0 -2
- package/get_internal_slots.d.ts +0 -2
- package/hour-cycles.generated.d.ts +0 -2
- package/index.d.ts +10 -0
- package/index.js +19 -3
- package/numbering-systems.generated.d.ts +0 -2
- package/package.json +5 -5
- package/polyfill.iife.js +82 -53
- package/should-polyfill.js +17 -1
- package/timezones.generated.d.ts +0 -2
- package/week-data.generated.d.ts +0 -2
package/calendars.generated.d.ts
CHANGED
package/get_internal_slots.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// Type-only circular import
|
|
2
|
-
// eslint-disable-next-line import/no-cycle
|
|
3
1
|
import type Locale from "./index.js";
|
|
4
2
|
import { type IntlLocaleInternal } from "./index.js";
|
|
5
3
|
export default function getInternalSlots(x: Locale, internalSlotsList?: string[]): IntlLocaleInternal;
|
package/index.d.ts
CHANGED
|
@@ -43,6 +43,16 @@ export declare class Locale {
|
|
|
43
43
|
* https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.region
|
|
44
44
|
*/
|
|
45
45
|
get region(): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the variant subtags of the locale, or undefined if none exist.
|
|
48
|
+
* Multiple variants are joined with hyphens in alphabetical order.
|
|
49
|
+
*
|
|
50
|
+
* Added in ECMA-402 via PR #960 to align with other subtag accessors.
|
|
51
|
+
* @see https://tc39.es/ecma402/#sec-Intl.Locale.prototype.variants
|
|
52
|
+
* @see https://github.com/tc39/ecma402/pull/960
|
|
53
|
+
* @see https://github.com/tc39/ecma402/issues/900
|
|
54
|
+
*/
|
|
55
|
+
get variants(): string | undefined;
|
|
46
56
|
get firstDayOfWeek(): string | undefined;
|
|
47
57
|
get hourCycle(): "h11" | "h12" | "h23" | "h24" | undefined;
|
|
48
58
|
/**
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoerceOptionsToObject, GetOption, HasOwnProperty, SameValue, createDataProperty, invariant } from "@formatjs/ecma402-abstract";
|
|
2
|
-
import { supportedValuesOf } from "@formatjs/intl-
|
|
2
|
+
import { supportedValuesOf } from "@formatjs/intl-supportedvaluesof";
|
|
3
3
|
import { emitUnicodeLanguageId, emitUnicodeLocaleId, isStructurallyValidLanguageTag, isUnicodeLanguageSubtag, isUnicodeRegionSubtag, isUnicodeScriptSubtag, likelySubtags, parseUnicodeLanguageId, parseUnicodeLocaleId } from "@formatjs/intl-getcanonicallocales";
|
|
4
4
|
import { characterOrders } from "./character-orders.generated.js";
|
|
5
5
|
import getInternalSlots from "./get_internal_slots.js";
|
|
@@ -235,8 +235,7 @@ function calendarsOfLocale(loc) {
|
|
|
235
235
|
function collationsOfLocale(loc) {
|
|
236
236
|
const locInternalSlots = getInternalSlots(loc);
|
|
237
237
|
const restricted = locInternalSlots.collation;
|
|
238
|
-
const
|
|
239
|
-
const supportedCollations = supportedValuesOf("collation", locale).filter((co) => co !== "standard" && co !== "search");
|
|
238
|
+
const supportedCollations = supportedValuesOf("collation").filter((co) => co !== "standard" && co !== "search");
|
|
240
239
|
supportedCollations.sort();
|
|
241
240
|
return createArrayFromListOrRestricted(supportedCollations, restricted);
|
|
242
241
|
}
|
|
@@ -472,6 +471,23 @@ export class Locale {
|
|
|
472
471
|
const locale = getInternalSlots(this).locale;
|
|
473
472
|
return parseUnicodeLanguageId(locale).region;
|
|
474
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Returns the variant subtags of the locale, or undefined if none exist.
|
|
476
|
+
* Multiple variants are joined with hyphens in alphabetical order.
|
|
477
|
+
*
|
|
478
|
+
* Added in ECMA-402 via PR #960 to align with other subtag accessors.
|
|
479
|
+
* @see https://tc39.es/ecma402/#sec-Intl.Locale.prototype.variants
|
|
480
|
+
* @see https://github.com/tc39/ecma402/pull/960
|
|
481
|
+
* @see https://github.com/tc39/ecma402/issues/900
|
|
482
|
+
*/
|
|
483
|
+
get variants() {
|
|
484
|
+
const locale = getInternalSlots(this).locale;
|
|
485
|
+
const variants = parseUnicodeLanguageId(locale).variants;
|
|
486
|
+
if (!variants || variants.length === 0) {
|
|
487
|
+
return undefined;
|
|
488
|
+
}
|
|
489
|
+
return variants.join("-");
|
|
490
|
+
}
|
|
475
491
|
get firstDayOfWeek() {
|
|
476
492
|
const internalSlots = getInternalSlots(this);
|
|
477
493
|
if (!HasOwnProperty(internalSlots, "initializedLocale")) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-locale",
|
|
3
3
|
"description": "Intl.Locale polyfill",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.2.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Long Ho <holevietlong@gmail.com>",
|
|
7
7
|
"type": "module",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"./should-polyfill.js": "./should-polyfill.js"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"tslib": "^2.8.
|
|
17
|
-
"@formatjs/ecma402-abstract": "3.0
|
|
18
|
-
"@formatjs/intl-
|
|
19
|
-
"@formatjs/intl-getcanonicallocales": "3.
|
|
16
|
+
"tslib": "^2.8.1",
|
|
17
|
+
"@formatjs/ecma402-abstract": "3.1.0",
|
|
18
|
+
"@formatjs/intl-supportedvaluesof": "2.2.0",
|
|
19
|
+
"@formatjs/intl-getcanonicallocales": "3.2.0"
|
|
20
20
|
},
|
|
21
21
|
"bugs": "https://github.com/formatjs/formatjs/issues",
|
|
22
22
|
"homepage": "https://github.com/formatjs/formatjs#readme",
|
package/polyfill.iife.js
CHANGED
|
@@ -2472,7 +2472,6 @@
|
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
2474
2474
|
var createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
2475
|
-
var createMemoizedDateTimeFormat = memoize((...args) => new Intl.DateTimeFormat(...args), { strategy: strategies.variadic });
|
|
2476
2475
|
var createMemoizedPluralRules = memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
2477
2476
|
var createMemoizedLocale = memoize((...args) => new Intl.Locale(...args), { strategy: strategies.variadic });
|
|
2478
2477
|
var createMemoizedListFormat = memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|
|
@@ -2603,7 +2602,7 @@
|
|
|
2603
2602
|
Decimal.set({ toExpPos: 100 });
|
|
2604
2603
|
|
|
2605
2604
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/regex.generated.js
|
|
2606
|
-
var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\
|
|
2605
|
+
var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/;
|
|
2607
2606
|
|
|
2608
2607
|
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/format_to_parts.js
|
|
2609
2608
|
var CARET_S_UNICODE_REGEX = new RegExp(`^${S_UNICODE_REGEX.source}`);
|
|
@@ -5913,7 +5912,10 @@
|
|
|
5913
5912
|
return RangePatternType2;
|
|
5914
5913
|
}({});
|
|
5915
5914
|
|
|
5916
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
5915
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/memoize.js
|
|
5916
|
+
var createMemoizedDateTimeFormat = memoize((...args) => new Intl.DateTimeFormat(...args), { strategy: strategies.variadic });
|
|
5917
|
+
|
|
5918
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/calendars.generated.js
|
|
5917
5919
|
var calendars = [
|
|
5918
5920
|
"buddhist",
|
|
5919
5921
|
"chinese",
|
|
@@ -5936,22 +5938,21 @@
|
|
|
5936
5938
|
"roc"
|
|
5937
5939
|
];
|
|
5938
5940
|
|
|
5939
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
5940
|
-
function isSupportedCalendar(item
|
|
5941
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/get-supported-calendars.js
|
|
5942
|
+
function isSupportedCalendar(item) {
|
|
5941
5943
|
try {
|
|
5942
|
-
const dateTimeFormat = createMemoizedDateTimeFormat(
|
|
5944
|
+
const dateTimeFormat = createMemoizedDateTimeFormat(`en-u-ca-${item}`);
|
|
5943
5945
|
const options = dateTimeFormat.resolvedOptions().calendar;
|
|
5944
|
-
|
|
5945
|
-
return true;
|
|
5946
|
+
return options === item;
|
|
5946
5947
|
} catch (e) {
|
|
5947
5948
|
}
|
|
5948
5949
|
return false;
|
|
5949
5950
|
}
|
|
5950
|
-
function getSupportedCalendars(
|
|
5951
|
-
return calendars.filter(
|
|
5951
|
+
function getSupportedCalendars() {
|
|
5952
|
+
return calendars.filter(isSupportedCalendar).sort();
|
|
5952
5953
|
}
|
|
5953
5954
|
|
|
5954
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
5955
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/collations.generated.js
|
|
5955
5956
|
var collations = [
|
|
5956
5957
|
"big5han",
|
|
5957
5958
|
"compat",
|
|
@@ -5974,19 +5975,19 @@
|
|
|
5974
5975
|
"zhuyin"
|
|
5975
5976
|
];
|
|
5976
5977
|
|
|
5977
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
5978
|
-
function
|
|
5978
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/get-supported-collations.js
|
|
5979
|
+
function isSupportedCollation(collation) {
|
|
5979
5980
|
try {
|
|
5980
|
-
return Intl.Collator(
|
|
5981
|
+
return Intl.Collator(`en-u-co-${collation}`).resolvedOptions().collation === collation;
|
|
5981
5982
|
} catch (e) {
|
|
5982
5983
|
}
|
|
5983
5984
|
return false;
|
|
5984
5985
|
}
|
|
5985
|
-
function getSupportedCollations(
|
|
5986
|
-
return collations.filter(
|
|
5986
|
+
function getSupportedCollations() {
|
|
5987
|
+
return collations.filter(isSupportedCollation).sort();
|
|
5987
5988
|
}
|
|
5988
5989
|
|
|
5989
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
5990
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/currencies.generated.js
|
|
5990
5991
|
var currencies = [
|
|
5991
5992
|
"ADP",
|
|
5992
5993
|
"AED",
|
|
@@ -6297,10 +6298,10 @@
|
|
|
6297
6298
|
"ZWR"
|
|
6298
6299
|
];
|
|
6299
6300
|
|
|
6300
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6301
|
-
function isSupportedCurrency(currency
|
|
6301
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/get-supported-currencies.js
|
|
6302
|
+
function isSupportedCurrency(currency) {
|
|
6302
6303
|
try {
|
|
6303
|
-
const numberFormat = createMemoizedNumberFormat(
|
|
6304
|
+
const numberFormat = createMemoizedNumberFormat("en", {
|
|
6304
6305
|
style: "currency",
|
|
6305
6306
|
currencyDisplay: "name",
|
|
6306
6307
|
currency
|
|
@@ -6313,12 +6314,12 @@
|
|
|
6313
6314
|
}
|
|
6314
6315
|
return false;
|
|
6315
6316
|
}
|
|
6316
|
-
function getSupportedCurrencies(
|
|
6317
|
+
function getSupportedCurrencies() {
|
|
6317
6318
|
const ATOZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
6318
6319
|
const supportedCurrencies = [];
|
|
6319
6320
|
for (const currency of currencies) {
|
|
6320
6321
|
if (currency.length === 3) {
|
|
6321
|
-
if (isSupportedCurrency(currency
|
|
6322
|
+
if (isSupportedCurrency(currency)) {
|
|
6322
6323
|
supportedCurrencies.push(currency);
|
|
6323
6324
|
}
|
|
6324
6325
|
} else if (currency.length === 5 && currency[3] === "~") {
|
|
@@ -6326,16 +6327,16 @@
|
|
|
6326
6327
|
const end = ATOZ.indexOf(currency[4]);
|
|
6327
6328
|
for (let i = start; i <= end; i++) {
|
|
6328
6329
|
const currentCurrency = currency.substring(0, 2) + ATOZ[i];
|
|
6329
|
-
if (isSupportedCurrency(currentCurrency
|
|
6330
|
+
if (isSupportedCurrency(currentCurrency)) {
|
|
6330
6331
|
supportedCurrencies.push(currentCurrency);
|
|
6331
6332
|
}
|
|
6332
6333
|
}
|
|
6333
6334
|
}
|
|
6334
6335
|
}
|
|
6335
|
-
return supportedCurrencies;
|
|
6336
|
+
return supportedCurrencies.sort();
|
|
6336
6337
|
}
|
|
6337
6338
|
|
|
6338
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6339
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/numbering-systems.generated.js
|
|
6339
6340
|
var numberingSystemNames = [
|
|
6340
6341
|
"adlm",
|
|
6341
6342
|
"ahom",
|
|
@@ -6436,10 +6437,10 @@
|
|
|
6436
6437
|
"wcho"
|
|
6437
6438
|
];
|
|
6438
6439
|
|
|
6439
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6440
|
-
function isSupportedNumberingSystem(system
|
|
6440
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/get-supported-numbering-systems.js
|
|
6441
|
+
function isSupportedNumberingSystem(system) {
|
|
6441
6442
|
try {
|
|
6442
|
-
const numberFormat = createMemoizedNumberFormat(
|
|
6443
|
+
const numberFormat = createMemoizedNumberFormat(`en-u-nu-${system}`);
|
|
6443
6444
|
const options = numberFormat.resolvedOptions().numberingSystem;
|
|
6444
6445
|
if (options === system && system === "latn" || numberFormat.format(123) !== "123") {
|
|
6445
6446
|
return true;
|
|
@@ -6448,11 +6449,11 @@
|
|
|
6448
6449
|
}
|
|
6449
6450
|
return false;
|
|
6450
6451
|
}
|
|
6451
|
-
function getSupportedNumberingSystems(
|
|
6452
|
-
return numberingSystemNames.filter(
|
|
6452
|
+
function getSupportedNumberingSystems() {
|
|
6453
|
+
return numberingSystemNames.filter(isSupportedNumberingSystem).sort();
|
|
6453
6454
|
}
|
|
6454
6455
|
|
|
6455
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6456
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/timezones.generated.js
|
|
6456
6457
|
var timezones = [
|
|
6457
6458
|
"Africa/Abidjan",
|
|
6458
6459
|
"Africa/Accra",
|
|
@@ -6883,20 +6884,20 @@
|
|
|
6883
6884
|
"Pacific/Wallis"
|
|
6884
6885
|
];
|
|
6885
6886
|
|
|
6886
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6887
|
-
function
|
|
6887
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/get-supported-timezones.js
|
|
6888
|
+
function isSupportedTimeZone(timeZone) {
|
|
6888
6889
|
try {
|
|
6889
|
-
const formatter = createMemoizedDateTimeFormat(
|
|
6890
|
+
const formatter = createMemoizedDateTimeFormat("en", { timeZone });
|
|
6890
6891
|
return formatter.resolvedOptions().timeZone === timeZone;
|
|
6891
6892
|
} catch (e) {
|
|
6892
6893
|
}
|
|
6893
6894
|
return false;
|
|
6894
6895
|
}
|
|
6895
|
-
function getSupportedTimeZones(
|
|
6896
|
-
return timezones.filter(
|
|
6896
|
+
function getSupportedTimeZones() {
|
|
6897
|
+
return timezones.filter(isSupportedTimeZone).sort();
|
|
6897
6898
|
}
|
|
6898
6899
|
|
|
6899
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6900
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/units.generated.js
|
|
6900
6901
|
var units = [
|
|
6901
6902
|
"degree",
|
|
6902
6903
|
"acre",
|
|
@@ -6943,10 +6944,10 @@
|
|
|
6943
6944
|
"milliliter"
|
|
6944
6945
|
];
|
|
6945
6946
|
|
|
6946
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6947
|
-
function
|
|
6947
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/get-supported-units.js
|
|
6948
|
+
function isSupportedUnit(unit) {
|
|
6948
6949
|
try {
|
|
6949
|
-
const formatter = createMemoizedNumberFormat(
|
|
6950
|
+
const formatter = createMemoizedNumberFormat("en", {
|
|
6950
6951
|
style: "unit",
|
|
6951
6952
|
unit
|
|
6952
6953
|
});
|
|
@@ -6955,25 +6956,25 @@
|
|
|
6955
6956
|
}
|
|
6956
6957
|
return false;
|
|
6957
6958
|
}
|
|
6958
|
-
function getSupportedUnits(
|
|
6959
|
-
return units.filter(
|
|
6959
|
+
function getSupportedUnits() {
|
|
6960
|
+
return units.filter(isSupportedUnit).sort();
|
|
6960
6961
|
}
|
|
6961
6962
|
|
|
6962
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-
|
|
6963
|
-
function supportedValuesOf(key
|
|
6963
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/src/index.js
|
|
6964
|
+
function supportedValuesOf(key) {
|
|
6964
6965
|
switch (key) {
|
|
6965
6966
|
case "calendar":
|
|
6966
|
-
return getSupportedCalendars(
|
|
6967
|
+
return getSupportedCalendars();
|
|
6967
6968
|
case "collation":
|
|
6968
|
-
return getSupportedCollations(
|
|
6969
|
+
return getSupportedCollations();
|
|
6969
6970
|
case "currency":
|
|
6970
|
-
return getSupportedCurrencies(
|
|
6971
|
+
return getSupportedCurrencies();
|
|
6971
6972
|
case "numberingSystem":
|
|
6972
|
-
return getSupportedNumberingSystems(
|
|
6973
|
+
return getSupportedNumberingSystems();
|
|
6973
6974
|
case "timeZone":
|
|
6974
|
-
return getSupportedTimeZones(
|
|
6975
|
+
return getSupportedTimeZones();
|
|
6975
6976
|
case "unit":
|
|
6976
|
-
return getSupportedUnits(
|
|
6977
|
+
return getSupportedUnits();
|
|
6977
6978
|
default:
|
|
6978
6979
|
throw RangeError("Invalid key: " + key);
|
|
6979
6980
|
}
|
|
@@ -22909,8 +22910,7 @@
|
|
|
22909
22910
|
function collationsOfLocale(loc) {
|
|
22910
22911
|
const locInternalSlots = getInternalSlots(loc);
|
|
22911
22912
|
const restricted = locInternalSlots.collation;
|
|
22912
|
-
const
|
|
22913
|
-
const supportedCollations = supportedValuesOf("collation", locale).filter(
|
|
22913
|
+
const supportedCollations = supportedValuesOf("collation").filter(
|
|
22914
22914
|
(co) => co !== "standard" && co !== "search"
|
|
22915
22915
|
);
|
|
22916
22916
|
supportedCollations.sort();
|
|
@@ -23174,6 +23174,23 @@
|
|
|
23174
23174
|
const locale = getInternalSlots(this).locale;
|
|
23175
23175
|
return parseUnicodeLanguageId(locale).region;
|
|
23176
23176
|
}
|
|
23177
|
+
/**
|
|
23178
|
+
* Returns the variant subtags of the locale, or undefined if none exist.
|
|
23179
|
+
* Multiple variants are joined with hyphens in alphabetical order.
|
|
23180
|
+
*
|
|
23181
|
+
* Added in ECMA-402 via PR #960 to align with other subtag accessors.
|
|
23182
|
+
* @see https://tc39.es/ecma402/#sec-Intl.Locale.prototype.variants
|
|
23183
|
+
* @see https://github.com/tc39/ecma402/pull/960
|
|
23184
|
+
* @see https://github.com/tc39/ecma402/issues/900
|
|
23185
|
+
*/
|
|
23186
|
+
get variants() {
|
|
23187
|
+
const locale = getInternalSlots(this).locale;
|
|
23188
|
+
const variants = parseUnicodeLanguageId(locale).variants;
|
|
23189
|
+
if (!variants || variants.length === 0) {
|
|
23190
|
+
return void 0;
|
|
23191
|
+
}
|
|
23192
|
+
return variants.join("-");
|
|
23193
|
+
}
|
|
23177
23194
|
get firstDayOfWeek() {
|
|
23178
23195
|
const internalSlots = getInternalSlots(this);
|
|
23179
23196
|
if (!HasOwnProperty(internalSlots, "initializedLocale")) {
|
|
@@ -23288,6 +23305,18 @@
|
|
|
23288
23305
|
return true;
|
|
23289
23306
|
}
|
|
23290
23307
|
}
|
|
23308
|
+
function hasVariantsProperty() {
|
|
23309
|
+
try {
|
|
23310
|
+
const locale = new Intl.Locale("en-US-posix");
|
|
23311
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
23312
|
+
Object.getPrototypeOf(locale),
|
|
23313
|
+
"variants"
|
|
23314
|
+
);
|
|
23315
|
+
return descriptor !== void 0 && typeof descriptor.get === "function";
|
|
23316
|
+
} catch (e) {
|
|
23317
|
+
return false;
|
|
23318
|
+
}
|
|
23319
|
+
}
|
|
23291
23320
|
function hasIncompleteLocaleInfo() {
|
|
23292
23321
|
try {
|
|
23293
23322
|
const locale = new Intl.Locale("en-US");
|
|
@@ -23303,7 +23332,7 @@
|
|
|
23303
23332
|
}
|
|
23304
23333
|
}
|
|
23305
23334
|
function shouldPolyfill2() {
|
|
23306
|
-
return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo();
|
|
23335
|
+
return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
|
|
23307
23336
|
}
|
|
23308
23337
|
|
|
23309
23338
|
// packages/intl-locale/polyfill.ts
|
package/should-polyfill.js
CHANGED
|
@@ -9,6 +9,22 @@ function hasIntlGetCanonicalLocalesBug() {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
+
* Check if Intl.Locale is missing the variants property.
|
|
13
|
+
* This property was added to ECMA-402 via PR #960.
|
|
14
|
+
* https://github.com/tc39/ecma402/pull/960
|
|
15
|
+
* https://github.com/tc39/ecma402/issues/900
|
|
16
|
+
*/
|
|
17
|
+
function hasVariantsProperty() {
|
|
18
|
+
try {
|
|
19
|
+
const locale = new Intl.Locale("en-US-posix");
|
|
20
|
+
// Check if variants property exists
|
|
21
|
+
const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(locale), "variants");
|
|
22
|
+
return descriptor !== undefined && typeof descriptor.get === "function";
|
|
23
|
+
} catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
12
28
|
* Check if Intl.Locale is missing critical methods from the Intl Locale Info proposal.
|
|
13
29
|
* Firefox has an incomplete implementation that lacks getWeekInfo() and other methods.
|
|
14
30
|
* https://github.com/formatjs/formatjs/issues/5112
|
|
@@ -33,5 +49,5 @@ function hasIncompleteLocaleInfo() {
|
|
|
33
49
|
}
|
|
34
50
|
}
|
|
35
51
|
export function shouldPolyfill() {
|
|
36
|
-
return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo();
|
|
52
|
+
return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
|
|
37
53
|
}
|
package/timezones.generated.d.ts
CHANGED