-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdiff.js
42 lines (37 loc) · 937 Bytes
/
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
32
33
34
35
36
37
38
39
40
41
42
// checking locales
f = (...args) => console.log(...args)
const _ = require('lodash')
const fs = require('fs')
const path = require('path')
const diff = require('deep-diff')
const yaml = require('js-yaml')
const directory = './locales'
const files = fs.readdirSync(directory)
const languages = []
files.forEach(file => {
let data = yaml.safeLoad(fs.readFileSync(directory + '/' + file))
if (data.is_enabled) {
languages.push({
locale: file,
data: data
})
}
})
const fallback = 'ru.yaml'
f('checking locales...')
languages.forEach(locale => {
if (locale.locale == fallback) {
return false
}
let check = diff(_.find(languages, {locale: fallback}).data, locale.data)
f('')
f(`=== start check ${locale.locale} - ${locale.data.language_name}`)
if (!check) {
return f(locale.locale + ' is ok!')
}
check.forEach(map => {
if (map.kind == 'D') {
f(map.path.join('.'))
}
})
})