{"size": 1038, "ext": "js", "max_stars_repo_path": "bin/compile-translations.js", "max_stars_repo_name": "DorianGrey/inferno-ts-template", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bin/compile-translations.js", "max_issues_repo_name": "DorianGrey/inferno-ts-template", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bin/compile-translations.js", "max_forks_repo_name": "DorianGrey/inferno-ts-template", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.5294117647, "max_line_length": 108, "alphanum_fraction": 0.6628131021}
"use strict";

const program = require("commander");
const logger = require("log4js").getLogger("translations");

const compileTranslations = require("../dev/translations").compile;

program
  .usage('[options] <files-glob> <output>')
  .option("-w, --watch", "Watch the translation files")
  .option("-v, --verbose", "Log some additional information")
  .option("-d, --duplicate-threshold <threshold>", "Limit the allowed translation duplication (in percent)")
  .parse(process.argv);

program.files = program.args[0];
program.output = program.args[1];

compileTranslations(program.files, program.output)
  .catch(e => {
    logger.error(e);
    if (!program.watch) {
      process.exit(1);
    }
  });

if (program.watch) {
  const watch = require("../dev/watch");
  watch(program.files, () => {
    compileTranslations(program.files, program.output).then(
      () => logger.log(`Translations written to ${program.output}`),
      err => logger.error("Error processing translation:", err)
    );
  }, {events: ["change", "unlink"]});
}