Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit 234cca8

Browse files
committed
follow up on PR #115: adding missing calendar packages from cldr
1 parent d8fa0eb commit 234cca8

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

package.json

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
},
1010
"devDependencies": {
1111
"async": "^0.9.0",
12+
"cldr-cal-buddhist-full": "^27.0.3",
13+
"cldr-cal-chinese-full": "^27.0.3",
14+
"cldr-cal-coptic-full": "^27.0.3",
15+
"cldr-cal-dangi-full": "^27.0.3",
16+
"cldr-cal-ethiopic-full": "^27.0.3",
17+
"cldr-cal-hebrew-full": "^27.0.3",
18+
"cldr-cal-indian-full": "^27.0.3",
19+
"cldr-cal-islamic-full": "^27.0.3",
20+
"cldr-cal-japanese-full": "^27.0.3",
21+
"cldr-cal-persian-full": "^27.0.3",
22+
"cldr-cal-roc-full": "^27.0.3",
1223
"cldr-core": "^27.0.3",
1324
"cldr-dates-full": "^27.0.3",
1425
"cldr-numbers-full": "^27.0.3",

tasks/utils/extract-calendars.js

+25-7
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,30 @@ module.exports = function extractCalendars(locales) {
8686
};
8787

8888
function loadCalendars(locale) {
89-
var dir = path.resolve(path.dirname(require.resolve('cldr-dates-full/package.json')), 'main', locale);
90-
var filenames = glob.sync("ca-*.json", {
91-
cwd: dir
92-
});
93-
94-
return filenames.reduce(function (calendars, filename) {
95-
return assign(calendars, require(path.join(dir, filename)).main[locale].dates.calendars);
89+
// all NPM packages providing calendars specific data
90+
var pkgs = [
91+
"cldr-dates-full",
92+
"cldr-cal-buddhist-full",
93+
"cldr-cal-chinese-full",
94+
"cldr-cal-coptic-full",
95+
"cldr-cal-dangi-full",
96+
"cldr-cal-ethiopic-full",
97+
"cldr-cal-hebrew-full",
98+
"cldr-cal-indian-full",
99+
"cldr-cal-islamic-full",
100+
"cldr-cal-japanese-full",
101+
"cldr-cal-persian-full",
102+
"cldr-cal-roc-full"
103+
];
104+
// walking all packages, selecting calendar files, then
105+
// reading the content of each calendar, and concatenating the set
106+
return pkgs.reduce(function (calendars, pkgName) {
107+
var dir = path.resolve(path.dirname(require.resolve(pkgName + '/package.json')), 'main', locale);
108+
var filenames = glob.sync("ca-*.json", {
109+
cwd: dir
110+
});
111+
return filenames.reduce(function (calendars, filename) {
112+
return assign(calendars, require(path.join(dir, filename)).main[locale].dates.calendars);
113+
}, calendars);
96114
}, {});
97115
}

0 commit comments

Comments
 (0)