1 import { en } from './src/translations/en';
2 import { eo } from './src/translations/eo';
3 import { es } from './src/translations/es';
4 import { de } from './src/translations/de';
5 import { fa } from './src/translations/fa';
6 import { zh } from './src/translations/zh';
7 import { fr } from './src/translations/fr';
8 import { sv } from './src/translations/sv';
9 import { ru } from './src/translations/ru';
10 import { nl } from './src/translations/nl';
11 import { it } from './src/translations/it';
12 import { fi } from './src/translations/fi';
13 import { ca } from './src/translations/ca';
30 const masterKeys = Object.keys(en.translation);
32 const readmePath = '../README.md';
34 const open = '<!-- translations -->';
35 const close = '<!-- translationsstop -->';
37 const readmeTxt = fs.readFileSync(readmePath, { encoding: 'utf8' });
39 const before = readmeTxt.split(open)[0];
40 const after = readmeTxt.split(close)[1];
42 function difference(a: Array<string>, b: Array<string>): Array<string> {
43 return a.filter(x => !b.includes(x));
47 'lang | done | missing\n' +
48 '---- | ---- | -------\n' +
51 const keys = Object.keys(file.t.translation);
52 const pct: number = (keys.length / masterKeys.length) * 100;
53 const missing = difference(masterKeys, keys);
54 return `${file.n} | ${pct.toFixed(0)}% | ${missing}`;
58 const alteredReadmeTxt = `${before}${open}\n\n${report}\n${close}${after}`;
60 fs.writeFileSync(readmePath, alteredReadmeTxt);