Lines 141-147
const poTasks = {
Link Here
|
141 |
}, |
141 |
}, |
142 |
}; |
142 |
}; |
143 |
|
143 |
|
144 |
const poTypes = Object.keys(poTasks); |
144 |
function getPoTasks () { |
|
|
145 |
let tasks = []; |
146 |
|
147 |
let all_tasks = Object.keys(poTasks); |
148 |
|
149 |
if (args.task) { |
150 |
tasks = [args.task].flat(Infinity); |
151 |
} else { |
152 |
return all_tasks; |
153 |
} |
154 |
|
155 |
let invalid_tasks = tasks.filter( function( el ) { |
156 |
return all_tasks.indexOf( el ) < 0; |
157 |
}); |
158 |
|
159 |
if ( invalid_tasks.length ) { |
160 |
console.error("Invalid task"); |
161 |
return []; |
162 |
} |
163 |
|
164 |
return tasks; |
165 |
} |
166 |
const poTypes = getPoTasks(); |
145 |
|
167 |
|
146 |
function po_extract_marc (type) { |
168 |
function po_extract_marc (type) { |
147 |
return src(`koha-tmpl/*-tmpl/*/en/**/*${type}*`, { read: false, nocase: true }) |
169 |
return src(`koha-tmpl/*-tmpl/*/en/**/*${type}*`, { read: false, nocase: true }) |
Lines 387-397
function getLanguages () {
Link Here
|
387 |
return [args.lang]; |
409 |
return [args.lang]; |
388 |
} |
410 |
} |
389 |
|
411 |
|
390 |
const filenames = fs.readdirSync('misc/translator/po') |
412 |
const filenames = fs.readdirSync('misc/translator/po/') |
391 |
.filter(filename => filename.endsWith('.po')) |
413 |
.filter(filename => filename.endsWith('-installer.po')) |
392 |
.filter(filename => !filename.startsWith('.')) |
414 |
.filter(filename => !filename.startsWith('.')) |
393 |
|
415 |
|
394 |
const re = new RegExp('-(' + poTypes.join('|') + ')\.po$'); |
416 |
const re = new RegExp('-installer.po'); |
395 |
languages = filenames.map(filename => filename.replace(re, '')) |
417 |
languages = filenames.map(filename => filename.replace(re, '')) |
396 |
|
418 |
|
397 |
return Array.from(new Set(languages)); |
419 |
return Array.from(new Set(languages)); |
398 |
- |
|
|