@formatjs/intl-locale 5.1.1 → 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/index.js CHANGED
@@ -1,582 +1,594 @@
1
- import { __assign, __spreadArray } from "tslib";
2
- import { CoerceOptionsToObject, GetOption, HasOwnProperty, SameValue, createDataProperty, invariant, } from '@formatjs/ecma402-abstract';
3
- import { supportedValuesOf } from '@formatjs/intl-enumerator';
4
- import { emitUnicodeLanguageId, emitUnicodeLocaleId, isStructurallyValidLanguageTag, isUnicodeLanguageSubtag, isUnicodeRegionSubtag, isUnicodeScriptSubtag, likelySubtags, parseUnicodeLanguageId, parseUnicodeLocaleId, } from '@formatjs/intl-getcanonicallocales';
5
- import { characterOrders } from './character-orders.generated.js';
6
- import getInternalSlots from './get_internal_slots.js';
7
- import { numberingSystems } from './numbering-systems.generated.js';
8
- import { getCalendarPreferenceDataForRegion, getHourCyclesPreferenceDataForLocaleOrRegion, getTimeZonePreferenceForRegion, getWeekDataForRegion, } from './preference-data.js';
9
- var ALPHANUM_3_8 = /^[a-z0-9]{3,8}$/i;
10
- var RELEVANT_EXTENSION_KEYS = [
11
- 'ca',
12
- 'co',
13
- 'hc',
14
- 'kf',
15
- 'kn',
16
- 'nu',
17
- 'fw',
1
+ import { CoerceOptionsToObject, GetOption, HasOwnProperty, SameValue, createDataProperty, invariant } from "@formatjs/ecma402-abstract";
2
+ import { supportedValuesOf } from "@formatjs/intl-supportedvaluesof";
3
+ import { emitUnicodeLanguageId, emitUnicodeLocaleId, isStructurallyValidLanguageTag, isUnicodeLanguageSubtag, isUnicodeRegionSubtag, isUnicodeScriptSubtag, likelySubtags, parseUnicodeLanguageId, parseUnicodeLocaleId } from "@formatjs/intl-getcanonicallocales";
4
+ import { characterOrders } from "./character-orders.generated.js";
5
+ import getInternalSlots from "./get_internal_slots.js";
6
+ import { numberingSystems } from "./numbering-systems.generated.js";
7
+ import { getCalendarPreferenceDataForRegion, getHourCyclesPreferenceDataForLocaleOrRegion, getTimeZonePreferenceForRegion, getWeekDataForRegion } from "./preference-data.js";
8
+ const ALPHANUM_3_8 = /^[a-z0-9]{3,8}$/i;
9
+ const RELEVANT_EXTENSION_KEYS = [
10
+ "ca",
11
+ "co",
12
+ "hc",
13
+ "kf",
14
+ "kn",
15
+ "nu",
16
+ "fw"
18
17
  ];
19
- var UNICODE_TYPE_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
18
+ const UNICODE_TYPE_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
20
19
  function applyOptionsToTag(tag, options) {
21
- invariant(typeof tag === 'string', 'language tag must be a string');
22
- invariant(isStructurallyValidLanguageTag(tag), 'malformed language tag', RangeError);
23
- var language = GetOption(options, 'language', 'string', undefined, undefined);
24
- if (language !== undefined) {
25
- invariant(isUnicodeLanguageSubtag(language), 'Malformed unicode_language_subtag', RangeError);
26
- }
27
- var script = GetOption(options, 'script', 'string', undefined, undefined);
28
- if (script !== undefined) {
29
- invariant(isUnicodeScriptSubtag(script), 'Malformed unicode_script_subtag', RangeError);
30
- }
31
- var region = GetOption(options, 'region', 'string', undefined, undefined);
32
- if (region !== undefined) {
33
- invariant(isUnicodeRegionSubtag(region), 'Malformed unicode_region_subtag', RangeError);
34
- }
35
- var languageId = parseUnicodeLanguageId(tag);
36
- if (language !== undefined) {
37
- languageId.lang = language;
38
- }
39
- if (script !== undefined) {
40
- languageId.script = script;
41
- }
42
- if (region !== undefined) {
43
- languageId.region = region;
44
- }
45
- return Intl.getCanonicalLocales(emitUnicodeLocaleId(__assign(__assign({}, parseUnicodeLocaleId(tag)), { lang: languageId })))[0];
20
+ invariant(typeof tag === "string", "language tag must be a string");
21
+ invariant(isStructurallyValidLanguageTag(tag), "malformed language tag", RangeError);
22
+ const language = GetOption(options, "language", "string", undefined, undefined);
23
+ if (language !== undefined) {
24
+ invariant(isUnicodeLanguageSubtag(language), "Malformed unicode_language_subtag", RangeError);
25
+ }
26
+ const script = GetOption(options, "script", "string", undefined, undefined);
27
+ if (script !== undefined) {
28
+ invariant(isUnicodeScriptSubtag(script), "Malformed unicode_script_subtag", RangeError);
29
+ }
30
+ const region = GetOption(options, "region", "string", undefined, undefined);
31
+ if (region !== undefined) {
32
+ invariant(isUnicodeRegionSubtag(region), "Malformed unicode_region_subtag", RangeError);
33
+ }
34
+ const languageId = parseUnicodeLanguageId(tag);
35
+ if (language !== undefined) {
36
+ languageId.lang = language;
37
+ }
38
+ if (script !== undefined) {
39
+ languageId.script = script;
40
+ }
41
+ if (region !== undefined) {
42
+ languageId.region = region;
43
+ }
44
+ return Intl.getCanonicalLocales(emitUnicodeLocaleId({
45
+ ...parseUnicodeLocaleId(tag),
46
+ lang: languageId
47
+ }))[0];
46
48
  }
47
49
  function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
48
- var unicodeExtension;
49
- var keywords = [];
50
- var ast = parseUnicodeLocaleId(tag);
51
- for (var _i = 0, _a = ast.extensions; _i < _a.length; _i++) {
52
- var ext = _a[_i];
53
- if (ext.type === 'u') {
54
- unicodeExtension = ext;
55
- if (Array.isArray(ext.keywords))
56
- keywords = ext.keywords;
57
- }
58
- }
59
- var result = Object.create(null);
60
- for (var _b = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _b < relevantExtensionKeys_1.length; _b++) {
61
- var key = relevantExtensionKeys_1[_b];
62
- var value = void 0, entry = void 0;
63
- for (var _c = 0, keywords_1 = keywords; _c < keywords_1.length; _c++) {
64
- var keyword = keywords_1[_c];
65
- if (keyword[0] === key) {
66
- entry = keyword;
67
- value = entry[1];
68
- }
69
- }
70
- invariant(key in options, "".concat(key, " must be in options"));
71
- var optionsValue = options[key];
72
- if (optionsValue !== undefined) {
73
- invariant(typeof optionsValue === 'string', "Value for ".concat(key, " must be a string"));
74
- value = optionsValue;
75
- if (entry) {
76
- entry[1] = value;
77
- }
78
- else {
79
- keywords.push([key, value]);
80
- }
81
- }
82
- result[key] = value;
83
- }
84
- if (!unicodeExtension) {
85
- if (keywords.length) {
86
- ast.extensions.push({
87
- type: 'u',
88
- keywords: keywords,
89
- attributes: [],
90
- });
91
- }
92
- }
93
- else {
94
- unicodeExtension.keywords = keywords;
95
- }
96
- result.locale = Intl.getCanonicalLocales(emitUnicodeLocaleId(ast))[0];
97
- return result;
50
+ let unicodeExtension;
51
+ let keywords = [];
52
+ const ast = parseUnicodeLocaleId(tag);
53
+ for (const ext of ast.extensions) {
54
+ if (ext.type === "u") {
55
+ unicodeExtension = ext;
56
+ if (Array.isArray(ext.keywords)) keywords = ext.keywords;
57
+ }
58
+ }
59
+ const result = Object.create(null);
60
+ for (const key of relevantExtensionKeys) {
61
+ let value, entry;
62
+ for (const keyword of keywords) {
63
+ if (keyword[0] === key) {
64
+ entry = keyword;
65
+ value = entry[1];
66
+ }
67
+ }
68
+ invariant(key in options, `${key} must be in options`);
69
+ const optionsValue = options[key];
70
+ if (optionsValue !== undefined) {
71
+ invariant(typeof optionsValue === "string", `Value for ${key} must be a string`);
72
+ value = optionsValue;
73
+ if (entry) {
74
+ entry[1] = value;
75
+ } else {
76
+ keywords.push([key, value]);
77
+ }
78
+ }
79
+ result[key] = value;
80
+ }
81
+ if (!unicodeExtension) {
82
+ if (keywords.length) {
83
+ ast.extensions.push({
84
+ type: "u",
85
+ keywords,
86
+ attributes: []
87
+ });
88
+ }
89
+ } else {
90
+ unicodeExtension.keywords = keywords;
91
+ }
92
+ result.locale = Intl.getCanonicalLocales(emitUnicodeLocaleId(ast))[0];
93
+ return result;
98
94
  }
99
- function mergeUnicodeLanguageId(lang, script, region, variants, replacement) {
100
- if (variants === void 0) { variants = []; }
101
- if (!replacement) {
102
- return {
103
- lang: lang || 'und',
104
- script: script,
105
- region: region,
106
- variants: variants,
107
- };
108
- }
109
- return {
110
- lang: !lang || lang === 'und' ? replacement.lang : lang,
111
- script: script || replacement.script,
112
- region: region || replacement.region,
113
- variants: __spreadArray(__spreadArray([], variants, true), replacement.variants, true),
114
- };
95
+ function mergeUnicodeLanguageId(lang, script, region, variants = [], replacement) {
96
+ if (!replacement) {
97
+ return {
98
+ lang: lang || "und",
99
+ script,
100
+ region,
101
+ variants
102
+ };
103
+ }
104
+ return {
105
+ lang: !lang || lang === "und" ? replacement.lang : lang,
106
+ script: script || replacement.script,
107
+ region: region || replacement.region,
108
+ variants: [...variants, ...replacement.variants]
109
+ };
115
110
  }
116
111
  function addLikelySubtags(tag) {
117
- var ast = parseUnicodeLocaleId(tag);
118
- var unicodeLangId = ast.lang;
119
- var lang = unicodeLangId.lang, script = unicodeLangId.script, region = unicodeLangId.region, variants = unicodeLangId.variants;
120
- if (script && region) {
121
- var match_1 = likelySubtags[emitUnicodeLanguageId({ lang: lang, script: script, region: region, variants: [] })];
122
- if (match_1) {
123
- var parts_1 = parseUnicodeLanguageId(match_1);
124
- ast.lang = mergeUnicodeLanguageId(undefined, undefined, undefined, variants, parts_1);
125
- return emitUnicodeLocaleId(ast);
126
- }
127
- }
128
- if (script) {
129
- var match_2 = likelySubtags[emitUnicodeLanguageId({ lang: lang, script: script, variants: [] })];
130
- if (match_2) {
131
- var parts_2 = parseUnicodeLanguageId(match_2);
132
- ast.lang = mergeUnicodeLanguageId(undefined, undefined, region, variants, parts_2);
133
- return emitUnicodeLocaleId(ast);
134
- }
135
- }
136
- if (region) {
137
- var match_3 = likelySubtags[emitUnicodeLanguageId({ lang: lang, region: region, variants: [] })];
138
- if (match_3) {
139
- var parts_3 = parseUnicodeLanguageId(match_3);
140
- ast.lang = mergeUnicodeLanguageId(undefined, script, undefined, variants, parts_3);
141
- return emitUnicodeLocaleId(ast);
142
- }
143
- }
144
- var match = likelySubtags[lang] ||
145
- likelySubtags[emitUnicodeLanguageId({ lang: 'und', script: script, variants: [] })];
146
- if (!match) {
147
- throw new Error("No match for addLikelySubtags");
148
- }
149
- var parts = parseUnicodeLanguageId(match);
150
- ast.lang = mergeUnicodeLanguageId(undefined, script, region, variants, parts);
151
- return emitUnicodeLocaleId(ast);
112
+ const ast = parseUnicodeLocaleId(tag);
113
+ const unicodeLangId = ast.lang;
114
+ const { lang, script, region, variants } = unicodeLangId;
115
+ if (script && region) {
116
+ const match = likelySubtags[emitUnicodeLanguageId({
117
+ lang,
118
+ script,
119
+ region,
120
+ variants: []
121
+ })];
122
+ if (match) {
123
+ const parts = parseUnicodeLanguageId(match);
124
+ ast.lang = mergeUnicodeLanguageId(undefined, undefined, undefined, variants, parts);
125
+ return emitUnicodeLocaleId(ast);
126
+ }
127
+ }
128
+ if (script) {
129
+ const match = likelySubtags[emitUnicodeLanguageId({
130
+ lang,
131
+ script,
132
+ variants: []
133
+ })];
134
+ if (match) {
135
+ const parts = parseUnicodeLanguageId(match);
136
+ ast.lang = mergeUnicodeLanguageId(undefined, undefined, region, variants, parts);
137
+ return emitUnicodeLocaleId(ast);
138
+ }
139
+ }
140
+ if (region) {
141
+ const match = likelySubtags[emitUnicodeLanguageId({
142
+ lang,
143
+ region,
144
+ variants: []
145
+ })];
146
+ if (match) {
147
+ const parts = parseUnicodeLanguageId(match);
148
+ ast.lang = mergeUnicodeLanguageId(undefined, script, undefined, variants, parts);
149
+ return emitUnicodeLocaleId(ast);
150
+ }
151
+ }
152
+ const match = likelySubtags[lang] || likelySubtags[emitUnicodeLanguageId({
153
+ lang: "und",
154
+ script,
155
+ variants: []
156
+ })];
157
+ if (!match) {
158
+ throw new Error(`No match for addLikelySubtags`);
159
+ }
160
+ const parts = parseUnicodeLanguageId(match);
161
+ ast.lang = mergeUnicodeLanguageId(undefined, script, region, variants, parts);
162
+ return emitUnicodeLocaleId(ast);
152
163
  }
153
164
  /**
154
- * From: https://github.com/unicode-org/icu/blob/4231ca5be053a22a1be24eb891817458c97db709/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java#L2395
155
- * @param tag
156
- */
165
+ * From: https://github.com/unicode-org/icu/blob/4231ca5be053a22a1be24eb891817458c97db709/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java#L2395
166
+ * @param tag
167
+ */
157
168
  function removeLikelySubtags(tag) {
158
- var maxLocale = addLikelySubtags(tag);
159
- if (!maxLocale) {
160
- return tag;
161
- }
162
- maxLocale = emitUnicodeLanguageId(__assign(__assign({}, parseUnicodeLanguageId(maxLocale)), { variants: [] }));
163
- var ast = parseUnicodeLocaleId(tag);
164
- var _a = ast.lang, lang = _a.lang, script = _a.script, region = _a.region, variants = _a.variants;
165
- var trial = addLikelySubtags(emitUnicodeLanguageId({ lang: lang, variants: [] }));
166
- if (trial === maxLocale) {
167
- return emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, undefined, variants) }));
168
- }
169
- if (region) {
170
- var trial_1 = addLikelySubtags(emitUnicodeLanguageId({ lang: lang, region: region, variants: [] }));
171
- if (trial_1 === maxLocale) {
172
- return emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, region, variants) }));
173
- }
174
- }
175
- if (script) {
176
- var trial_2 = addLikelySubtags(emitUnicodeLanguageId({ lang: lang, script: script, variants: [] }));
177
- if (trial_2 === maxLocale) {
178
- return emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, script, undefined, variants) }));
179
- }
180
- }
181
- return tag;
169
+ let maxLocale = addLikelySubtags(tag);
170
+ if (!maxLocale) {
171
+ return tag;
172
+ }
173
+ maxLocale = emitUnicodeLanguageId({
174
+ ...parseUnicodeLanguageId(maxLocale),
175
+ variants: []
176
+ });
177
+ const ast = parseUnicodeLocaleId(tag);
178
+ const { lang: { lang, script, region, variants } } = ast;
179
+ const trial = addLikelySubtags(emitUnicodeLanguageId({
180
+ lang,
181
+ variants: []
182
+ }));
183
+ if (trial === maxLocale) {
184
+ return emitUnicodeLocaleId({
185
+ ...ast,
186
+ lang: mergeUnicodeLanguageId(lang, undefined, undefined, variants)
187
+ });
188
+ }
189
+ if (region) {
190
+ const trial = addLikelySubtags(emitUnicodeLanguageId({
191
+ lang,
192
+ region,
193
+ variants: []
194
+ }));
195
+ if (trial === maxLocale) {
196
+ return emitUnicodeLocaleId({
197
+ ...ast,
198
+ lang: mergeUnicodeLanguageId(lang, undefined, region, variants)
199
+ });
200
+ }
201
+ }
202
+ if (script) {
203
+ const trial = addLikelySubtags(emitUnicodeLanguageId({
204
+ lang,
205
+ script,
206
+ variants: []
207
+ }));
208
+ if (trial === maxLocale) {
209
+ return emitUnicodeLocaleId({
210
+ ...ast,
211
+ lang: mergeUnicodeLanguageId(lang, script, undefined, variants)
212
+ });
213
+ }
214
+ }
215
+ return tag;
182
216
  }
183
217
  function createArrayFromListOrRestricted(list, restricted) {
184
- var result = list;
185
- if (restricted !== undefined) {
186
- result = [restricted];
187
- }
188
- return Array.from(result);
218
+ let result = list;
219
+ if (restricted !== undefined) {
220
+ result = [restricted];
221
+ }
222
+ return Array.from(result);
189
223
  }
190
224
  function calendarsOfLocale(loc) {
191
- var locInternalSlots = getInternalSlots(loc);
192
- var restricted = locInternalSlots.calendar;
193
- var locale = locInternalSlots.locale;
194
- var region;
195
- if (locale !== 'root') {
196
- region = loc.maximize().region;
197
- }
198
- var preferredCalendars = getCalendarPreferenceDataForRegion(region);
199
- return createArrayFromListOrRestricted(preferredCalendars, restricted);
225
+ const locInternalSlots = getInternalSlots(loc);
226
+ const restricted = locInternalSlots.calendar;
227
+ const locale = locInternalSlots.locale;
228
+ let region;
229
+ if (locale !== "root") {
230
+ region = loc.maximize().region;
231
+ }
232
+ const preferredCalendars = getCalendarPreferenceDataForRegion(region);
233
+ return createArrayFromListOrRestricted(preferredCalendars, restricted);
200
234
  }
201
235
  function collationsOfLocale(loc) {
202
- var locInternalSlots = getInternalSlots(loc);
203
- var restricted = locInternalSlots.collation;
204
- var locale = locInternalSlots.locale;
205
- var supportedCollations = supportedValuesOf('collation', locale).filter(function (co) { return co !== 'standard' && co !== 'search'; });
206
- supportedCollations.sort();
207
- return createArrayFromListOrRestricted(supportedCollations, restricted);
236
+ const locInternalSlots = getInternalSlots(loc);
237
+ const restricted = locInternalSlots.collation;
238
+ const supportedCollations = supportedValuesOf("collation").filter((co) => co !== "standard" && co !== "search");
239
+ supportedCollations.sort();
240
+ return createArrayFromListOrRestricted(supportedCollations, restricted);
208
241
  }
209
242
  function hourCyclesOfLocale(loc) {
210
- var locInternalSlots = getInternalSlots(loc);
211
- var restricted = locInternalSlots.hourCycle;
212
- var locale = locInternalSlots.locale;
213
- var region;
214
- if (locale !== 'root') {
215
- region = loc.maximize().region;
216
- }
217
- var preferredHourCycles = getHourCyclesPreferenceDataForLocaleOrRegion(locale, region);
218
- return createArrayFromListOrRestricted(preferredHourCycles, restricted);
243
+ const locInternalSlots = getInternalSlots(loc);
244
+ const restricted = locInternalSlots.hourCycle;
245
+ const locale = locInternalSlots.locale;
246
+ let region;
247
+ if (locale !== "root") {
248
+ region = loc.maximize().region;
249
+ }
250
+ const preferredHourCycles = getHourCyclesPreferenceDataForLocaleOrRegion(locale, region);
251
+ return createArrayFromListOrRestricted(preferredHourCycles, restricted);
219
252
  }
220
253
  function numberingSystemsOfLocale(loc) {
221
- var _a;
222
- var locInternalSlots = getInternalSlots(loc);
223
- var restricted = locInternalSlots.numberingSystem;
224
- var locale = locInternalSlots.locale;
225
- var language = loc.language;
226
- var localeNumberingSystems = (_a = numberingSystems[locale]) !== null && _a !== void 0 ? _a : numberingSystems[language];
227
- if (localeNumberingSystems) {
228
- return createArrayFromListOrRestricted(__spreadArray([], localeNumberingSystems, true), restricted);
229
- }
230
- return createArrayFromListOrRestricted([], restricted);
254
+ const locInternalSlots = getInternalSlots(loc);
255
+ const restricted = locInternalSlots.numberingSystem;
256
+ const locale = locInternalSlots.locale;
257
+ const language = loc.language;
258
+ const localeNumberingSystems = numberingSystems[locale] ?? numberingSystems[language];
259
+ if (localeNumberingSystems) {
260
+ return createArrayFromListOrRestricted([...localeNumberingSystems], restricted);
261
+ }
262
+ return createArrayFromListOrRestricted([], restricted);
231
263
  }
232
264
  function timeZonesOfLocale(loc) {
233
- var locInternalSlots = getInternalSlots(loc);
234
- var locale = locInternalSlots.locale;
235
- var region = parseUnicodeLanguageId(locale).region;
236
- if (!region) {
237
- return undefined;
238
- }
239
- var preferredTimeZones = getTimeZonePreferenceForRegion(region);
240
- preferredTimeZones.sort();
241
- return Array.from(preferredTimeZones);
265
+ const locInternalSlots = getInternalSlots(loc);
266
+ const locale = locInternalSlots.locale;
267
+ const region = parseUnicodeLanguageId(locale).region;
268
+ if (!region) {
269
+ return undefined;
270
+ }
271
+ const preferredTimeZones = getTimeZonePreferenceForRegion(region);
272
+ preferredTimeZones.sort();
273
+ return Array.from(preferredTimeZones);
242
274
  }
243
275
  function translateCharacterOrder(order) {
244
- if (order === 'right-to-left') {
245
- return 'rtl';
246
- }
247
- return 'ltr';
276
+ if (order === "right-to-left") {
277
+ return "rtl";
278
+ }
279
+ return "ltr";
248
280
  }
249
281
  function characterDirectionOfLocale(loc) {
250
- var locale = loc.minimize().toString();
251
- return translateCharacterOrder(characterOrders[locale]);
282
+ const locale = loc.minimize().toString();
283
+ return translateCharacterOrder(characterOrders[locale]);
252
284
  }
253
285
  function weekInfoOfLocale(loc) {
254
- var locInternalSlots = getInternalSlots(loc);
255
- var locale = locInternalSlots.locale;
256
- var region;
257
- if (locale !== 'root') {
258
- region = loc.maximize().region;
259
- }
260
- return getWeekDataForRegion(region);
286
+ const locInternalSlots = getInternalSlots(loc);
287
+ const locale = locInternalSlots.locale;
288
+ let region;
289
+ if (locale !== "root") {
290
+ region = loc.maximize().region;
291
+ }
292
+ return getWeekDataForRegion(region);
261
293
  }
262
- var TABLE_1 = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
294
+ const TABLE_1 = [
295
+ "sun",
296
+ "mon",
297
+ "tue",
298
+ "wed",
299
+ "thu",
300
+ "fri",
301
+ "sat"
302
+ ];
263
303
  function weekdayToString(fw) {
264
- return TABLE_1[+fw];
265
- }
266
- var Locale = /** @class */ (function () {
267
- function Locale(tag, opts) {
268
- // test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js
269
- // Cannot use `new.target` bc of IE11 & TS transpiles it to something else
270
- var newTarget = this && this instanceof Locale ? this.constructor : void 0;
271
- if (!newTarget) {
272
- throw new TypeError("Intl.Locale must be called with 'new'");
273
- }
274
- var relevantExtensionKeys = Locale.relevantExtensionKeys;
275
- var internalSlotsList = [
276
- 'initializedLocale',
277
- 'locale',
278
- 'calendar',
279
- 'collation',
280
- 'hourCycle',
281
- 'numberingSystem',
282
- ];
283
- if (relevantExtensionKeys.indexOf('kf') > -1) {
284
- internalSlotsList.push('caseFirst');
285
- }
286
- if (relevantExtensionKeys.indexOf('kn') > -1) {
287
- internalSlotsList.push('numeric');
288
- }
289
- if (tag === undefined) {
290
- throw new TypeError("First argument to Intl.Locale constructor can't be empty or missing");
291
- }
292
- if (typeof tag !== 'string' && typeof tag !== 'object') {
293
- throw new TypeError('tag must be a string or object');
294
- }
295
- var tagInternalSlots;
296
- if (typeof tag === 'object' &&
297
- (tagInternalSlots = getInternalSlots(tag)) &&
298
- HasOwnProperty(tagInternalSlots, 'initializedLocale')) {
299
- tag = tagInternalSlots.locale;
300
- }
301
- else {
302
- tag = tag.toString();
303
- }
304
- var internalSlots = getInternalSlots(this, internalSlotsList);
305
- var options = CoerceOptionsToObject(opts);
306
- tag = applyOptionsToTag(tag, options);
307
- var opt = Object.create(null);
308
- var calendar = GetOption(options, 'calendar', 'string', undefined, undefined);
309
- if (calendar !== undefined) {
310
- if (!UNICODE_TYPE_REGEX.test(calendar)) {
311
- throw new RangeError('invalid calendar');
312
- }
313
- }
314
- opt.ca = calendar;
315
- var collation = GetOption(options, 'collation', 'string', undefined, undefined);
316
- if (collation !== undefined) {
317
- if (!UNICODE_TYPE_REGEX.test(collation)) {
318
- throw new RangeError('invalid collation');
319
- }
320
- }
321
- opt.co = collation;
322
- var fw = GetOption(options, 'firstDayOfWeek', 'string', undefined, undefined);
323
- if (fw !== undefined) {
324
- fw = weekdayToString(fw);
325
- if (!ALPHANUM_3_8.test(fw)) {
326
- throw new RangeError('Invalid firstDayOfWeek');
327
- }
328
- }
329
- opt.fw = fw;
330
- var hc = GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
331
- opt.hc = hc;
332
- var kf = GetOption(options, 'caseFirst', 'string', ['upper', 'lower', 'false'], undefined);
333
- opt.kf = kf;
334
- var _kn = GetOption(options, 'numeric', 'boolean', undefined, undefined);
335
- var kn;
336
- if (_kn !== undefined) {
337
- kn = String(_kn);
338
- }
339
- opt.kn = kn;
340
- var numberingSystem = GetOption(options, 'numberingSystem', 'string', undefined, undefined);
341
- if (numberingSystem !== undefined) {
342
- if (!UNICODE_TYPE_REGEX.test(numberingSystem)) {
343
- throw new RangeError('Invalid numberingSystem');
344
- }
345
- }
346
- opt.nu = numberingSystem;
347
- var r = applyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys);
348
- internalSlots.locale = r.locale;
349
- internalSlots.calendar = r.ca;
350
- internalSlots.collation = r.co;
351
- internalSlots.firstDayOfWeek = r.fw;
352
- internalSlots.hourCycle = r.hc;
353
- if (relevantExtensionKeys.indexOf('kf') > -1) {
354
- internalSlots.caseFirst = r.kf;
355
- }
356
- if (relevantExtensionKeys.indexOf('kn') > -1) {
357
- internalSlots.numeric = SameValue(r.kn, 'true');
358
- }
359
- internalSlots.numberingSystem = r.nu;
360
- }
361
- /**
362
- * https://www.unicode.org/reports/tr35/#Likely_Subtags
363
- */
364
- Locale.prototype.maximize = function () {
365
- var locale = getInternalSlots(this).locale;
366
- try {
367
- var maximizedLocale = addLikelySubtags(locale);
368
- return new Locale(maximizedLocale);
369
- }
370
- catch (_a) {
371
- return new Locale(locale);
372
- }
373
- };
374
- /**
375
- * https://www.unicode.org/reports/tr35/#Likely_Subtags
376
- */
377
- Locale.prototype.minimize = function () {
378
- var locale = getInternalSlots(this).locale;
379
- try {
380
- var minimizedLocale = removeLikelySubtags(locale);
381
- return new Locale(minimizedLocale);
382
- }
383
- catch (_a) {
384
- return new Locale(locale);
385
- }
386
- };
387
- Locale.prototype.toString = function () {
388
- return getInternalSlots(this).locale;
389
- };
390
- Object.defineProperty(Locale.prototype, "baseName", {
391
- get: function () {
392
- var locale = getInternalSlots(this).locale;
393
- return emitUnicodeLanguageId(parseUnicodeLanguageId(locale));
394
- },
395
- enumerable: false,
396
- configurable: true
397
- });
398
- Object.defineProperty(Locale.prototype, "calendar", {
399
- get: function () {
400
- return getInternalSlots(this).calendar;
401
- },
402
- enumerable: false,
403
- configurable: true
404
- });
405
- Object.defineProperty(Locale.prototype, "collation", {
406
- get: function () {
407
- return getInternalSlots(this).collation;
408
- },
409
- enumerable: false,
410
- configurable: true
411
- });
412
- Object.defineProperty(Locale.prototype, "caseFirst", {
413
- get: function () {
414
- return getInternalSlots(this).caseFirst;
415
- },
416
- enumerable: false,
417
- configurable: true
418
- });
419
- Object.defineProperty(Locale.prototype, "numeric", {
420
- get: function () {
421
- return getInternalSlots(this).numeric;
422
- },
423
- enumerable: false,
424
- configurable: true
425
- });
426
- Object.defineProperty(Locale.prototype, "numberingSystem", {
427
- get: function () {
428
- return getInternalSlots(this).numberingSystem;
429
- },
430
- enumerable: false,
431
- configurable: true
432
- });
433
- Object.defineProperty(Locale.prototype, "language", {
434
- /**
435
- * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.language
436
- */
437
- get: function () {
438
- var locale = getInternalSlots(this).locale;
439
- return parseUnicodeLanguageId(locale).lang;
440
- },
441
- enumerable: false,
442
- configurable: true
443
- });
444
- Object.defineProperty(Locale.prototype, "script", {
445
- /**
446
- * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.script
447
- */
448
- get: function () {
449
- var locale = getInternalSlots(this).locale;
450
- return parseUnicodeLanguageId(locale).script;
451
- },
452
- enumerable: false,
453
- configurable: true
454
- });
455
- Object.defineProperty(Locale.prototype, "region", {
456
- /**
457
- * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.region
458
- */
459
- get: function () {
460
- var locale = getInternalSlots(this).locale;
461
- return parseUnicodeLanguageId(locale).region;
462
- },
463
- enumerable: false,
464
- configurable: true
465
- });
466
- Object.defineProperty(Locale.prototype, "firstDayOfWeek", {
467
- get: function () {
468
- var internalSlots = getInternalSlots(this);
469
- if (!HasOwnProperty(internalSlots, 'initializedLocale')) {
470
- throw new TypeError('Error uninitialized locale');
471
- }
472
- return internalSlots.firstDayOfWeek;
473
- },
474
- enumerable: false,
475
- configurable: true
476
- });
477
- Object.defineProperty(Locale.prototype, "hourCycle", {
478
- get: function () {
479
- var internalSlots = getInternalSlots(this);
480
- if (!HasOwnProperty(internalSlots, 'initializedLocale')) {
481
- throw new TypeError('Error uninitialized locale');
482
- }
483
- return internalSlots.hourCycle;
484
- },
485
- enumerable: false,
486
- configurable: true
487
- });
488
- /**
489
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCalendars
490
- * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getCalendars
491
- */
492
- Locale.prototype.getCalendars = function () {
493
- return calendarsOfLocale(this);
494
- };
495
- /**
496
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCollations
497
- * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getCollations
498
- */
499
- Locale.prototype.getCollations = function () {
500
- return collationsOfLocale(this);
501
- };
502
- /**
503
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getHourCycles
504
- * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getHourCycles
505
- */
506
- Locale.prototype.getHourCycles = function () {
507
- var internalSlots = getInternalSlots(this);
508
- if (!HasOwnProperty(internalSlots, 'initializedLocale')) {
509
- throw new TypeError('Error uninitialized locale');
510
- }
511
- return hourCyclesOfLocale(this);
512
- };
513
- /**
514
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getNumberingSystems
515
- * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getNumberingSystems
516
- */
517
- Locale.prototype.getNumberingSystems = function () {
518
- return numberingSystemsOfLocale(this);
519
- };
520
- /**
521
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTimeZones
522
- * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getTimeZones
523
- */
524
- Locale.prototype.getTimeZones = function () {
525
- return timeZonesOfLocale(this);
526
- };
527
- /**
528
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
529
- * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getTextInfo
530
- */
531
- Locale.prototype.getTextInfo = function () {
532
- var info = Object.create(Object.prototype);
533
- var dir = characterDirectionOfLocale(this);
534
- createDataProperty(info, 'direction', dir);
535
- return info;
536
- };
537
- /**
538
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo
539
- * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getWeekInfo
540
- */
541
- Locale.prototype.getWeekInfo = function () {
542
- var info = Object.create(Object.prototype);
543
- var internalSlots = getInternalSlots(this);
544
- if (!HasOwnProperty(internalSlots, 'initializedLocale')) {
545
- throw new TypeError('Error uninitialized locale');
546
- }
547
- var wi = weekInfoOfLocale(this);
548
- var we = wi.weekend;
549
- createDataProperty(info, 'firstDay', wi.firstDay);
550
- createDataProperty(info, 'weekend', we);
551
- createDataProperty(info, 'minimalDays', wi.minimalDays);
552
- var fw = internalSlots.firstDayOfWeek;
553
- if (fw !== undefined) {
554
- info.firstDay = fw;
555
- }
556
- return info;
557
- };
558
- Locale.relevantExtensionKeys = RELEVANT_EXTENSION_KEYS;
559
- Locale.polyfilled = true;
560
- return Locale;
561
- }());
562
- export { Locale };
563
- try {
564
- if (typeof Symbol !== 'undefined') {
565
- Object.defineProperty(Locale.prototype, Symbol.toStringTag, {
566
- value: 'Intl.Locale',
567
- writable: false,
568
- enumerable: false,
569
- configurable: true,
570
- });
571
- }
572
- Object.defineProperty(Locale.prototype.constructor, 'length', {
573
- value: 1,
574
- writable: false,
575
- enumerable: false,
576
- configurable: true,
577
- });
304
+ return TABLE_1[+fw];
578
305
  }
579
- catch (_a) {
580
- // Meta fix so we're test262-compliant, not important
306
+ export class Locale {
307
+ constructor(tag, opts) {
308
+ // test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js
309
+ // Cannot use `new.target` bc of IE11 & TS transpiles it to something else
310
+ const newTarget = this && this instanceof Locale ? this.constructor : void 0;
311
+ if (!newTarget) {
312
+ throw new TypeError("Intl.Locale must be called with 'new'");
313
+ }
314
+ const { relevantExtensionKeys } = Locale;
315
+ const internalSlotsList = [
316
+ "initializedLocale",
317
+ "locale",
318
+ "calendar",
319
+ "collation",
320
+ "hourCycle",
321
+ "numberingSystem"
322
+ ];
323
+ if (relevantExtensionKeys.indexOf("kf") > -1) {
324
+ internalSlotsList.push("caseFirst");
325
+ }
326
+ if (relevantExtensionKeys.indexOf("kn") > -1) {
327
+ internalSlotsList.push("numeric");
328
+ }
329
+ if (tag === undefined) {
330
+ throw new TypeError("First argument to Intl.Locale constructor can't be empty or missing");
331
+ }
332
+ if (typeof tag !== "string" && typeof tag !== "object") {
333
+ throw new TypeError("tag must be a string or object");
334
+ }
335
+ let tagInternalSlots;
336
+ if (typeof tag === "object" && (tagInternalSlots = getInternalSlots(tag)) && HasOwnProperty(tagInternalSlots, "initializedLocale")) {
337
+ tag = tagInternalSlots.locale;
338
+ } else {
339
+ tag = tag.toString();
340
+ }
341
+ let internalSlots = getInternalSlots(this, internalSlotsList);
342
+ let options = CoerceOptionsToObject(opts);
343
+ tag = applyOptionsToTag(tag, options);
344
+ const opt = Object.create(null);
345
+ const calendar = GetOption(options, "calendar", "string", undefined, undefined);
346
+ if (calendar !== undefined) {
347
+ if (!UNICODE_TYPE_REGEX.test(calendar)) {
348
+ throw new RangeError("invalid calendar");
349
+ }
350
+ }
351
+ opt.ca = calendar;
352
+ const collation = GetOption(options, "collation", "string", undefined, undefined);
353
+ if (collation !== undefined) {
354
+ if (!UNICODE_TYPE_REGEX.test(collation)) {
355
+ throw new RangeError("invalid collation");
356
+ }
357
+ }
358
+ opt.co = collation;
359
+ let fw = GetOption(options, "firstDayOfWeek", "string", undefined, undefined);
360
+ if (fw !== undefined) {
361
+ fw = weekdayToString(fw);
362
+ if (!ALPHANUM_3_8.test(fw)) {
363
+ throw new RangeError("Invalid firstDayOfWeek");
364
+ }
365
+ }
366
+ opt.fw = fw;
367
+ const hc = GetOption(options, "hourCycle", "string", [
368
+ "h11",
369
+ "h12",
370
+ "h23",
371
+ "h24"
372
+ ], undefined);
373
+ opt.hc = hc;
374
+ const kf = GetOption(options, "caseFirst", "string", [
375
+ "upper",
376
+ "lower",
377
+ "false"
378
+ ], undefined);
379
+ opt.kf = kf;
380
+ const _kn = GetOption(options, "numeric", "boolean", undefined, undefined);
381
+ let kn;
382
+ if (_kn !== undefined) {
383
+ kn = String(_kn);
384
+ }
385
+ opt.kn = kn;
386
+ const numberingSystem = GetOption(options, "numberingSystem", "string", undefined, undefined);
387
+ if (numberingSystem !== undefined) {
388
+ if (!UNICODE_TYPE_REGEX.test(numberingSystem)) {
389
+ throw new RangeError("Invalid numberingSystem");
390
+ }
391
+ }
392
+ opt.nu = numberingSystem;
393
+ const r = applyUnicodeExtensionToTag(tag, opt, relevantExtensionKeys);
394
+ internalSlots.locale = r.locale;
395
+ internalSlots.calendar = r.ca;
396
+ internalSlots.collation = r.co;
397
+ internalSlots.firstDayOfWeek = r.fw;
398
+ internalSlots.hourCycle = r.hc;
399
+ if (relevantExtensionKeys.indexOf("kf") > -1) {
400
+ internalSlots.caseFirst = r.kf;
401
+ }
402
+ if (relevantExtensionKeys.indexOf("kn") > -1) {
403
+ internalSlots.numeric = SameValue(r.kn, "true");
404
+ }
405
+ internalSlots.numberingSystem = r.nu;
406
+ }
407
+ /**
408
+ * https://www.unicode.org/reports/tr35/#Likely_Subtags
409
+ */
410
+ maximize() {
411
+ const locale = getInternalSlots(this).locale;
412
+ try {
413
+ const maximizedLocale = addLikelySubtags(locale);
414
+ return new Locale(maximizedLocale);
415
+ } catch {
416
+ return new Locale(locale);
417
+ }
418
+ }
419
+ /**
420
+ * https://www.unicode.org/reports/tr35/#Likely_Subtags
421
+ */
422
+ minimize() {
423
+ const locale = getInternalSlots(this).locale;
424
+ try {
425
+ const minimizedLocale = removeLikelySubtags(locale);
426
+ return new Locale(minimizedLocale);
427
+ } catch {
428
+ return new Locale(locale);
429
+ }
430
+ }
431
+ toString() {
432
+ return getInternalSlots(this).locale;
433
+ }
434
+ get baseName() {
435
+ const locale = getInternalSlots(this).locale;
436
+ return emitUnicodeLanguageId(parseUnicodeLanguageId(locale));
437
+ }
438
+ get calendar() {
439
+ return getInternalSlots(this).calendar;
440
+ }
441
+ get collation() {
442
+ return getInternalSlots(this).collation;
443
+ }
444
+ get caseFirst() {
445
+ return getInternalSlots(this).caseFirst;
446
+ }
447
+ get numeric() {
448
+ return getInternalSlots(this).numeric;
449
+ }
450
+ get numberingSystem() {
451
+ return getInternalSlots(this).numberingSystem;
452
+ }
453
+ /**
454
+ * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.language
455
+ */
456
+ get language() {
457
+ const locale = getInternalSlots(this).locale;
458
+ return parseUnicodeLanguageId(locale).lang;
459
+ }
460
+ /**
461
+ * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.script
462
+ */
463
+ get script() {
464
+ const locale = getInternalSlots(this).locale;
465
+ return parseUnicodeLanguageId(locale).script;
466
+ }
467
+ /**
468
+ * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.region
469
+ */
470
+ get region() {
471
+ const locale = getInternalSlots(this).locale;
472
+ return parseUnicodeLanguageId(locale).region;
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
+ }
491
+ get firstDayOfWeek() {
492
+ const internalSlots = getInternalSlots(this);
493
+ if (!HasOwnProperty(internalSlots, "initializedLocale")) {
494
+ throw new TypeError("Error uninitialized locale");
495
+ }
496
+ return internalSlots.firstDayOfWeek;
497
+ }
498
+ get hourCycle() {
499
+ const internalSlots = getInternalSlots(this);
500
+ if (!HasOwnProperty(internalSlots, "initializedLocale")) {
501
+ throw new TypeError("Error uninitialized locale");
502
+ }
503
+ return internalSlots.hourCycle;
504
+ }
505
+ /**
506
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCalendars
507
+ * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getCalendars
508
+ */
509
+ getCalendars() {
510
+ return calendarsOfLocale(this);
511
+ }
512
+ /**
513
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCollations
514
+ * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getCollations
515
+ */
516
+ getCollations() {
517
+ return collationsOfLocale(this);
518
+ }
519
+ /**
520
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getHourCycles
521
+ * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getHourCycles
522
+ */
523
+ getHourCycles() {
524
+ const internalSlots = getInternalSlots(this);
525
+ if (!HasOwnProperty(internalSlots, "initializedLocale")) {
526
+ throw new TypeError("Error uninitialized locale");
527
+ }
528
+ return hourCyclesOfLocale(this);
529
+ }
530
+ /**
531
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getNumberingSystems
532
+ * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getNumberingSystems
533
+ */
534
+ getNumberingSystems() {
535
+ return numberingSystemsOfLocale(this);
536
+ }
537
+ /**
538
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTimeZones
539
+ * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getTimeZones
540
+ */
541
+ getTimeZones() {
542
+ return timeZonesOfLocale(this);
543
+ }
544
+ /**
545
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
546
+ * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getTextInfo
547
+ */
548
+ getTextInfo() {
549
+ const info = Object.create(Object.prototype);
550
+ const dir = characterDirectionOfLocale(this);
551
+ createDataProperty(info, "direction", dir);
552
+ return info;
553
+ }
554
+ /**
555
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo
556
+ * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getWeekInfo
557
+ */
558
+ getWeekInfo() {
559
+ const info = Object.create(Object.prototype);
560
+ const internalSlots = getInternalSlots(this);
561
+ if (!HasOwnProperty(internalSlots, "initializedLocale")) {
562
+ throw new TypeError("Error uninitialized locale");
563
+ }
564
+ const wi = weekInfoOfLocale(this);
565
+ const we = wi.weekend;
566
+ createDataProperty(info, "firstDay", wi.firstDay);
567
+ createDataProperty(info, "weekend", we);
568
+ createDataProperty(info, "minimalDays", wi.minimalDays);
569
+ const fw = internalSlots.firstDayOfWeek;
570
+ if (fw !== undefined) {
571
+ info.firstDay = fw;
572
+ }
573
+ return info;
574
+ }
575
+ static relevantExtensionKeys = RELEVANT_EXTENSION_KEYS;
576
+ static polyfilled = true;
581
577
  }
578
+ try {
579
+ if (typeof Symbol !== "undefined") {
580
+ Object.defineProperty(Locale.prototype, Symbol.toStringTag, {
581
+ value: "Intl.Locale",
582
+ writable: false,
583
+ enumerable: false,
584
+ configurable: true
585
+ });
586
+ }
587
+ Object.defineProperty(Locale.prototype.constructor, "length", {
588
+ value: 1,
589
+ writable: false,
590
+ enumerable: false,
591
+ configurable: true
592
+ });
593
+ } catch {}
582
594
  export default Locale;