wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
i18n/check-i18n.js
@@ -26,15 +26,9 @@
        ) // 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) {
@@ -44,7 +38,7 @@
              iterateKeys(obj[key], nestedKey)
          }
        }
        iterateKeys(translationObj)
        iterateKeys(translation)
        allKeys = [...keys, ...nestedKeys].map(
          key => `${camelCaseFileName}.${key}`,