-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxliff-tool-extract.js
executable file
·47 lines (39 loc) · 1.06 KB
/
xliff-tool-extract.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
const { description, version } = require('./package.json');
const program = require('commander');
const xlf2po = require('./xlf2po.js');
function printUsageAndExit() {
program.outputHelp();
process.exit(1);
}
let xlfFileName;
let poFileName;
program
.description(description)
.version(version, '-v, --version')
.arguments('<xlfFile>')
.action(function (xlfFile, poFile) {
xlfFileName = xlfFile;
})
.option(
'-w --normalize-whitespace',
'Normalizes whitespace to a single space character and trims leading and trailing whitespace.',
)
.option(
'-o --output-file <outputFile>',
'Redirects output to a file.'
)
.option(
'--enable-angular-optimizations',
'Enable some optimizations to work around specific angular issues.',
)
.parse(process.argv)
;
if (!xlfFileName) {
printUsageAndExit();
}
let options = {
normalizeWhitespace: program.normalizeWhitespace || false,
outputFile: program.outputFile || false,
};
xlf2po(xlfFileName, options);