1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Migrate clean and importl10n target to gulp

This commit is contained in:
Tim van der Meij 2016-03-04 21:14:56 +01:00
parent b8aaa24257
commit 96cca2b37a
3 changed files with 31 additions and 23 deletions

View file

@ -41,7 +41,7 @@ function normalizeText(s) {
return s.replace(/\r\n?/g, '\n').replace(/\uFEFF/g, '');
}
function downloadLanguageFiles(langCode, callback) {
function downloadLanguageFiles(root, langCode, callback) {
console.log('Downloading ' + langCode + '...');
// Constants for constructing the URLs. Translations are taken from the
@ -56,12 +56,12 @@ function downloadLanguageFiles(langCode, callback) {
var downloadsLeft = files.length;
if (!fs.existsSync(langCode)) {
fs.mkdirSync(langCode);
fs.mkdirSync(path.join(root, langCode));
}
// Download the necessary files for this language.
files.forEach(function(fileName) {
var outputPath = path.join(langCode, fileName);
var outputPath = path.join(root, langCode, fileName);
var url = MOZCENTRAL_ROOT + langCode + MOZCENTRAL_PDFJS_DIR +
fileName + MOZCENTRAL_RAW_FLAG;
var request = http.get(url, function(response) {
@ -81,13 +81,13 @@ function downloadLanguageFiles(langCode, callback) {
});
}
function downloadL10n() {
function downloadL10n(root) {
var i = 0;
(function next() {
if (i >= langCodes.length) {
return;
}
downloadLanguageFiles(langCodes[i++], next);
downloadLanguageFiles(root, langCodes[i++], next);
})();
}