Automatic compare check in Angular i18n json files
Use a small Node.js script
Since you already have Angular installed (which means you have NPM & Node.Js), you can find inconsistencies in your translation JSON files with a script. Here's how it looks
Code
const fs = require('fs');// Define your file paths hereconst files = ['./english.json', './russian.json']// Read contents and parse JSONconst filesWithKeys = files.map(f => ({ name: f, content: JSON.parse(fs.readFileSync(f, 'utf8'))}));// Gather all the keys used in all files in one arrayconst allKeys = filesWithKeys.map(f => Object.keys(f.content)).flat();// Find the missing keys by fileconst missingKeysByFile = filesWithKeys.map(f => ({ name: f.name, missingKeys: allKeys.filter(k => !(k in f.content))})).filter(f => f.missingKeys.length > 0);// Print the resultmissingKeysByFile.forEach(f => { console.log(`File "${f.name}" is missing keys [ ${f.missingKeys.join(' ')} ]`);});
Sample output
File "english.json" is missing keys [ appTitle, contentHeader ]File "russian.json" is missing keys [ usernameHint ]
You can check Pootle (http://pootle.translatehouse.org/index.html) or Poedit (https://poedit.net) or POEditor (https://poeditor.com/)