-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
32 lines (24 loc) · 772 Bytes
/
app.js
File metadata and controls
32 lines (24 loc) · 772 Bytes
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
'use strict'
const path = require('path');
const fileService = require('./services/file.service');
let dictionary;
const dictionaryPath = path.resolve(__dirname, './files/input/dictionary.csv');
const dictionaries = {
es: {},
en: {}
};
fileService.getJsonFromCsv(dictionaryPath)
.then((dictionaryData) => {
dictionary = dictionaryData;
dictionary.forEach((item) => {
dictionaries.es[item.Key] = item.ES;
dictionaries.en[item.Key] = item.EN;
});
return Promise.all([
fileService.createJsonFile(dictionaries.es, 'es.json'),
fileService.createJsonFile(dictionaries.en, 'en.json')
]);
})
.then(() => fileService.createMoFiles(dictionary))
.then(() => console.log(`done!!!`))
.catch((err) => console.error(err))