forked from libremesh/lime-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
i18n-diff.js
31 lines (23 loc) · 990 Bytes
/
i18n-diff.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const genericFile = require('./i18n/generic.json').en;
const translations = require('./i18n');
const colors = require('colors');
const missing = (master, slave) => {
const slaveKeys = Object.keys(slave);
return Object.keys(master).filter(key => slaveKeys.indexOf(key)=== -1);
};
const surplus = (master, slave) => {
const masterKeys = Object.keys(master);
return Object.keys(slave).filter(key => masterKeys.indexOf(key) === -1);
};
const init = () => {
console.log(colors.bold.underline('Translations differences'));
const translationsKeys = Object.keys(translations);
translationsKeys.forEach((lang) => {
const translationsMissing = missing(genericFile,translations[lang]);
const translationsSurplus = surplus(genericFile,translations[lang]);
console.log(colors.bold(' ./i18n/translations/' + lang + '.json'))
translationsMissing.map(x => console.log(colors.green(' +++ '+ x)))
translationsSurplus.map(x => console.log(colors.red(' --- '+ x)))
});
};
init();