diff --git a/packages/business/src/views/verification/components/ConditionBox.vue b/packages/business/src/views/verification/components/ConditionBox.vue index 51ae33269e..3fffddf9e5 100644 --- a/packages/business/src/views/verification/components/ConditionBox.vue +++ b/packages/business/src/views/verification/components/ConditionBox.vue @@ -427,11 +427,9 @@ const getConnectionsInTask = async ( const connectionId = t.connectionId const connectionName = t.attrs?.connectionName const databaseType = t.databaseType - const findDynamicSchema = t.attrs?.capabilities.find( - (t: any) => t.id === 'dynamic_schema', - ) - if (findDynamicSchema) { - dynamicSchemaMap[t.connectionId] = true + + if (hasCapability(databaseType, 'dynamic_schema')) { + dynamicSchemaMap[connectionId] = true } return { attrs: { @@ -1223,6 +1221,7 @@ const validateCapabilities = (tasks: any[], capability: string) => { return message } +// i18n-ignore-start const loadDoc = () => { if (i18n.locale === 'en') { doc.value = `##### Advanced Verification Instructions @@ -1302,6 +1301,7 @@ return {result: 'failed',message: "记录不一致",data: targetRow} ` } } +// i18n-ignore-end const getModeTypeDisabled = (item: any) => { return ( diff --git a/scripts/check-i18n.js b/scripts/check-i18n.js index aec8543185..b7b5e2b362 100644 --- a/scripts/check-i18n.js +++ b/scripts/check-i18n.js @@ -48,6 +48,10 @@ const LINE_SKIP_PATTERNS = [ /\/\/\s*NOTE/, // NOTE 注释 ] +// 多行排除标记 —— 仅匹配独立的行注释 +const I18N_IGNORE_START_RE = /^\s*\/\/\s*i18n-ignore-start\s*$/ +const I18N_IGNORE_END_RE = /^\s*\/\/\s*i18n-ignore-end\s*$/ + // 已国际化调用模式 —— 行内中文如果全部在这些调用内部则放行 const I18N_CALL_PATTERNS = [ /\$t\s*\(/, // $t('key') @@ -118,11 +122,17 @@ function checkFile(filePath) { let inBlockComment = false let inHtmlComment = false + let inI18nIgnoreBlock = false let skipBlockDepth = 0 // 块级排除:追踪括号深度 for (const [i, line] of lines.entries()) { const lineNum = i + 1 + if (inI18nIgnoreBlock) { + if (I18N_IGNORE_END_RE.test(line)) inI18nIgnoreBlock = false + continue + } + // HTML 块注释追踪 if (inHtmlComment) { if (line.includes('-->')) inHtmlComment = false @@ -165,6 +175,11 @@ function checkFile(filePath) { // 单行块注释 if (/^\s*\/\*.*\*\//.test(line)) continue + if (I18N_IGNORE_START_RE.test(line)) { + inI18nIgnoreBlock = true + continue + } + // 无中文则跳过 if (!CHINESE_RE.test(line)) continue @@ -260,6 +275,9 @@ if (allErrors.length > 0) { } console.error("\u001B[33m提示: 请使用 $t('key') 或 t('key') 进行国际化处理。") console.error('如需忽略某行,请在行尾添加注释: // i18n-ignore\u001B[0m\n') + console.error( + '如需忽略多行内容,请用独立注释 // i18n-ignore-start 和 // i18n-ignore-end 包围。\n', + ) process.exit(1) } else { console.log('\u001B[32m✓ 未发现中文硬编码问题\u001B[0m')