@formatjs/intl-locale 3.4.1 → 3.4.3
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/LICENSE.md +1 -1
- package/lib/calendars.generated.js +1 -4
- package/lib/character-orders.generated.js +1 -4
- package/lib/get_internal_slots.js +1 -4
- package/lib/hour-cycles.generated.js +1 -4
- package/lib/index.js +96 -99
- package/lib/numbering-systems.generated.js +1 -4
- package/lib/polyfill-force.js +2 -4
- package/lib/polyfill.js +4 -6
- package/lib/preference-data.js +18 -25
- package/lib/should-polyfill.js +1 -5
- package/lib/timezones.generated.js +1 -4
- package/lib/week-data.generated.js +1 -4
- package/package.json +4 -4
- package/polyfill.iife.js +17740 -24900
package/lib/preference-data.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var calendars_generated_1 = require("./calendars.generated");
|
|
8
|
-
var week_data_generated_1 = require("./week-data.generated");
|
|
9
|
-
function getCalendarPreferenceDataForRegion(region) {
|
|
1
|
+
import { __spreadArray } from "tslib";
|
|
2
|
+
import { timezones } from './timezones.generated';
|
|
3
|
+
import { hourCycles } from './hour-cycles.generated';
|
|
4
|
+
import { calendars } from './calendars.generated';
|
|
5
|
+
import { weekData } from './week-data.generated';
|
|
6
|
+
export function getCalendarPreferenceDataForRegion(region) {
|
|
10
7
|
var _region = region ? region.toUpperCase() : null;
|
|
11
|
-
return (
|
|
8
|
+
return (calendars[(_region || '')] || calendars['001']).map(function (c) {
|
|
12
9
|
// Resolve aliases
|
|
13
10
|
// cldr-json/cldr-code v42.0.0-ALPHA3-2
|
|
14
11
|
// https://github.com/unicode-org/cldr-json/blob/42.0.0-ALPHA3-2/cldr-json/cldr-bcp47/bcp47/calendar.json
|
|
@@ -27,27 +24,23 @@ function getCalendarPreferenceDataForRegion(region) {
|
|
|
27
24
|
return c;
|
|
28
25
|
});
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
function getHourCyclesPreferenceDataForLocaleOrRegion(locale, region) {
|
|
27
|
+
export function getHourCyclesPreferenceDataForLocaleOrRegion(locale, region) {
|
|
32
28
|
var _locale = locale.toLowerCase();
|
|
33
29
|
var _region = (region ? region.toUpperCase() : '');
|
|
34
|
-
var hourCyclesPreference =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
30
|
+
var hourCyclesPreference = hourCycles[_locale] ||
|
|
31
|
+
hourCycles[_region] ||
|
|
32
|
+
hourCycles["".concat(_locale, "-001")] ||
|
|
33
|
+
hourCycles['001'];
|
|
34
|
+
return __spreadArray([], hourCyclesPreference, true);
|
|
39
35
|
}
|
|
40
|
-
|
|
41
|
-
function getTimeZonePreferenceForRegion(region) {
|
|
36
|
+
export function getTimeZonePreferenceForRegion(region) {
|
|
42
37
|
var territory = region.toLowerCase();
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
38
|
+
if (timezones[territory]) {
|
|
39
|
+
return __spreadArray([], timezones[territory], true);
|
|
45
40
|
}
|
|
46
41
|
return [];
|
|
47
42
|
}
|
|
48
|
-
|
|
49
|
-
function getWeekDataForRegion(region) {
|
|
43
|
+
export function getWeekDataForRegion(region) {
|
|
50
44
|
var _region = (region ? region.toUpperCase() : '');
|
|
51
|
-
return
|
|
45
|
+
return weekData[_region || '001'] || weekData['001'];
|
|
52
46
|
}
|
|
53
|
-
exports.getWeekDataForRegion = getWeekDataForRegion;
|
package/lib/should-polyfill.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shouldPolyfill = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* https://bugs.chromium.org/p/v8/issues/detail?id=10682
|
|
6
3
|
*/
|
|
@@ -12,7 +9,6 @@ function hasIntlGetCanonicalLocalesBug() {
|
|
|
12
9
|
return true;
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
function shouldPolyfill() {
|
|
12
|
+
export function shouldPolyfill() {
|
|
16
13
|
return !('Locale' in Intl) || hasIntlGetCanonicalLocalesBug();
|
|
17
14
|
}
|
|
18
|
-
exports.shouldPolyfill = shouldPolyfill;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-locale",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.3",
|
|
4
4
|
"description": "Intl.Locale polyfill",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"tslib": "^2.4.0",
|
|
28
|
-
"@formatjs/
|
|
29
|
-
"@formatjs/
|
|
30
|
-
"@formatjs/intl-
|
|
28
|
+
"@formatjs/intl-enumerator": "1.4.3",
|
|
29
|
+
"@formatjs/ecma402-abstract": "1.18.0",
|
|
30
|
+
"@formatjs/intl-getcanonicallocales": "2.3.0"
|
|
31
31
|
}
|
|
32
32
|
}
|