]> Untitled Git - lemmy.git/blob - ui/translation_report.ts
Adding emoji support.
[lemmy.git] / ui / translation_report.ts
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 { zh } from './src/translations/zh';
6 import { fr } from './src/translations/fr';
7 import { sv } from './src/translations/sv';
8 import { ru } from './src/translations/ru';
9 import { nl } from './src/translations/nl';
10
11 let files = [
12   {t: de, n: 'de'}, 
13   {t: eo, n: 'eo'}, 
14   {t: es, n: 'es'}, 
15   {t: fr, n: 'fr'}, 
16   {t: nl, n: 'nl'}, 
17   {t: ru, n: 'ru'}, 
18   {t: sv, n: 'sv'}, 
19   {t: zh, n: 'zh'}, 
20 ];
21 let masterKeys = Object.keys(en.translation);
22
23 let report = 'lang | done | missing\n';
24 report += '--- | --- | ---\n';
25
26 for (let file of files) {
27   let keys = Object.keys(file.t.translation);
28   let pct: number = (keys.length / masterKeys.length * 100);
29   let missing = difference(masterKeys, keys);
30   report += `${file.n} | ${pct.toFixed(0)}% | ${missing} \n`;
31 }
32
33 console.log(report);
34
35 function difference(a: Array<string>, b: Array<string>): Array<string> {
36   return a.filter(x => !b.includes(x));
37 }