mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -05:00
Only catch the ENOENT
error
The catch there before is meant to just continue if it comes across a file that doesn't exist (in which case the language will default to english). However, it was not specific enough – now, it only catches the error if the file doesn't exist, and throws anything else, preveting a build.
This commit is contained in:
parent
faf3549509
commit
3c2fec42f2
1 changed files with 8 additions and 6 deletions
|
@ -54,10 +54,6 @@ if (!args.length) {
|
||||||
process.stdout.write('A destination directory must be specified.');
|
process.stdout.write('A destination directory must be specified.');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
var verbose = false;
|
|
||||||
if (args.length > 1) {
|
|
||||||
verbose = (args[1] === '-v') ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var poUiDir = path.resolve(__dirname, '../node_modules/scratchr2_translations/ui');
|
var poUiDir = path.resolve(__dirname, '../node_modules/scratchr2_translations/ui');
|
||||||
var outputDir = path.resolve(__dirname, '../', args[0]);
|
var outputDir = path.resolve(__dirname, '../', args[0]);
|
||||||
|
@ -129,17 +125,23 @@ glob(poUiDir + '/*', function (err, files) {
|
||||||
var translations = {};
|
var translations = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
fs.accessSync(jsFile, fs.R_OK);
|
||||||
var jsTranslations = po2icu.poFileToICUSync(lang, jsFile);
|
var jsTranslations = po2icu.poFileToICUSync(lang, jsFile);
|
||||||
translations = localeCompare.mergeNewTranslations(translations, jsTranslations, idsWithICU, md5WithIds);
|
translations = localeCompare.mergeNewTranslations(translations, jsTranslations, idsWithICU, md5WithIds);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (verbose) process.stdout.write(lang + ': ' + err + '\n');
|
if (err.code !== 'ENOENT') {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
fs.accessSync(pyFile, fs.R_OK);
|
||||||
var pyTranslations = po2icu.poFileToICUSync(lang, pyFile);
|
var pyTranslations = po2icu.poFileToICUSync(lang, pyFile);
|
||||||
translations = localeCompare.mergeNewTranslations(translations, pyTranslations, idsWithICU, md5WithIds);
|
translations = localeCompare.mergeNewTranslations(translations, pyTranslations, idsWithICU, md5WithIds);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (verbose) process.stdout.write(lang + ': ' + err + '\n');
|
if (err.code !== 'ENOENT') {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add new translations to locale object
|
// add new translations to locale object
|
||||||
|
|
Loading…
Reference in a new issue