fix(i18n): string generation not working correctly #33

This commit is contained in:
Johannes Millan 2019-07-12 19:45:07 +02:00
parent 46ae8fcd73
commit bb38b3b157
2 changed files with 29 additions and 29 deletions

View file

@ -5,19 +5,19 @@ console.log(path);
const _tr = fs.readFileSync(path);
const tr = JSON.parse(_tr);
const parse = (o) => {
const parse = (o, pref = '') => {
return Object.keys(o).reduce((acc, key) => {
console.log(key);
if (typeof o[key] === 'object') {
return {
...acc,
[key]: parse(o[key]),
[key]: parse(o[key], key + '.'),
};
} else if (typeof o[key] === 'string') {
return {
...acc,
[key]: key,
[key]: pref + key,
};
} else {
throw 'Invalid Data';