From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- i18n/check-i18n.js | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/i18n/check-i18n.js b/i18n/check-i18n.js index 55a2301..fbe1bbd 100644 --- a/i18n/check-i18n.js +++ b/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}`, -- Gitblit v1.8.0