Fix building PO template

The current version failed with

    Option "--directory" requires 1 arguments, but 0 were provided

In the current stdio npm module version, getopt() now requires a
`default:` attribute, otherwise it considers the options as required.

Also sync PO helpers with current cockpit.

Add PO template build to travis check, to make sure that it keeps
working.

Closes #375
This commit is contained in:
Martin Pitt 2020-09-29 12:04:13 +02:00 committed by Marius Vollmer
parent 6f8cd78783
commit cbedf06704
4 changed files with 19 additions and 10 deletions

View file

@ -46,10 +46,10 @@ function prepareHeader(header) {
}
/* A function for the front end */
statement = header["plural-forms"];
statement = header["plural-forms"];
if (statement[statement.length - 1] != ';')
statement += ';';
ret = 'function(n) {\nvar nplurals, plural;\n' + statement + '\nreturn plural;\n}';
ret = 'function(n) {\nvar nplurals, plural;\n' + statement + '\nreturn plural;\n}';
/* Added back in later */
delete header["plural-forms"];
@ -72,7 +72,7 @@ function prepareHeader(header) {
/* Parse and process the po data */
function parse() {
filename = opts.args[0];
po2json.parseFile(opts.args[0], { "fuzzy": true }, function(err, jsonData) {
po2json.parseFile(opts.args[0], { "fuzzy": false }, function(err, jsonData) {
var plurals, pos;
if (err)
@ -117,7 +117,7 @@ function finish(data) {
if (opts.output) {
fs.writeFile(opts.output, data, function(err) {
if (err)
fatal(err.message);
fatal(err.message);
process.exit(0);
});
} else {