| | |
| | | ) // Convert to camel case |
| | | // console.log(camelCaseFileName) |
| | | const content = fs.readFileSync(filePath, 'utf8') |
| | | // eslint-disable-next-line sonarjs/code-eval |
| | | const translationObj = eval(transpile(content)) |
| | | const translation = eval(transpile(content)) |
| | | // console.log(translation) |
| | | if(!translationObj || typeof translationObj !== 'object') { |
| | | console.error(`Error parsing file: ${filePath}`) |
| | | reject(new Error(`Error parsing file: ${filePath}`)) |
| | | return |
| | | } |
| | | const keys = Object.keys(translationObj) |
| | | const keys = Object.keys(translation) |
| | | const nestedKeys = [] |
| | | const iterateKeys = (obj, prefix = '') => { |
| | | for (const key in obj) { |
| | |
| | | iterateKeys(obj[key], nestedKey) |
| | | } |
| | | } |
| | | iterateKeys(translationObj) |
| | | iterateKeys(translation) |
| | | |
| | | allKeys = [...keys, ...nestedKeys].map( |
| | | key => `${camelCaseFileName}.${key}`, |