<commit_before>#!/usr/bin/env node

const
  fs = require('fs'),
  validateEnvironment = require('../private/validateEnvironment'),
  getLanguages = require('../private/getLanguages'),
  inspect = require('../private/inspect'),
  compare = require('../private/compare'),
  { forEach } = require('lodash')

  //const processDir = process.cwd() //needed for node package
  //const configDir = `${processDir}/i18n-tracker.config.json`
  processDir = '../../test-client/translations', //temporary for testing
  configDir = '../../test-client/translations/i18n-tracker.config.json' //temporary for testing


let config
try {
  config = JSON.parse(fs.readFileSync(configDir, 'utf8'))
} catch (e) {
  throw new Error('i18n-tracker.config.json missing')
}

//validate the environment
const environmentValid = validateEnvironment(processDir, config)

const baseObj = require(`${processDir}/${config.base[0]}`)
const baseName = config.base[0]


const languages = getLanguages(config.translations)
const german = require(`${processDir}/${languages[0][0]}`)

console.log(languages);

const omissions = inspect(baseObj, baseName)

// const copy = omissions.nests.slice()

// console.log('--------------slice is:-------------------');
// console.log(JSON.stringify(copy,null,4));

require('colors') /* ---------- FOR DEBUGGING -------------- */

forEach(languages, (language) => {

  const langObj = require(`${processDir}/${language[0]}`)
  compare(omissions, language[0], langObj)

})

console.log(JSON.stringify(omissions.comparisons, null, 4).yellow);

// compare()
//omissions.logOmissions()<commit_msg>- removed some debugging logs - log the omissions once we have compared<commit_after>#!/usr/bin/env node

const
  fs = require('fs'),
  validateEnvironment = require('../private/validateEnvironment'),
  getLanguages = require('../private/getLanguages'),
  inspect = require('../private/inspect'),
  compare = require('../private/compare'),
  { forEach } = require('lodash')

  //const processDir = process.cwd() //needed for node package
  //const configDir = `${processDir}/i18n-tracker.config.json`
  processDir = '../../test-client/translations', //temporary for testing
  configDir = '../../test-client/translations/i18n-tracker.config.json' //temporary for testing


let config
try {
  config = JSON.parse(fs.readFileSync(configDir, 'utf8'))
} catch (e) {
  throw new Error('i18n-tracker.config.json missing')
}

//validate the environment
const environmentValid = validateEnvironment(processDir, config)

const baseObj = require(`${processDir}/${config.base[0]}`)
const baseName = config.base[0]


const languages = getLanguages(config.translations)
const german = require(`${processDir}/${languages[0][0]}`)

const omissions = inspect(baseObj, baseName)


forEach(languages, (language) => {

  const langObj = require(`${processDir}/${language[0]}`)
  compare(omissions, language[0], langObj)

})

omissions.logOmissions(languages)
{'fraction_non_alphanumeric': 0.1866257250085295, 'fraction_numerical': 0.009553053565336063, 'mean_word_length': 4.321234119782214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '571399', 'n_tokens_mistral': 903, 'n_tokens_neox': 883, 'n_words': 182}