refactor(i18n): use JSON with flattened key and namespace (#30114)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Stephen Zhou
2025-12-29 14:52:32 +08:00
committed by GitHub
parent 09be869f58
commit 6d0e36479b
2552 changed files with 111159 additions and 142972 deletions

View File

@ -10,7 +10,7 @@ import {
} from './constants'
import { DataSourceClassification } from './types'
const i18nPrefix = 'workflow.errorMsg'
const i18nPrefix = 'errorMsg'
const metaData = genNodeMetaData({
sort: -1,
@ -28,7 +28,7 @@ const nodeDefault: NodeDefault<DataSourceNodeType> = {
const { dataSourceInputsSchema, notAuthed } = moreDataForCheckValid
let errorMessage = ''
if (notAuthed)
errorMessage = t(`${i18nPrefix}.authRequired`)
errorMessage = t(`${i18nPrefix}.authRequired`, { ns: 'workflow' })
if (!errorMessage) {
dataSourceInputsSchema.filter((field: any) => {
@ -36,17 +36,17 @@ const nodeDefault: NodeDefault<DataSourceNodeType> = {
}).forEach((field: any) => {
const targetVar = payload.datasource_parameters[field.variable]
if (!targetVar) {
errorMessage = t(`${i18nPrefix}.fieldRequired`, { field: field.label })
errorMessage = t(`${i18nPrefix}.fieldRequired`, { ns: 'workflow', field: field.label })
return
}
const { type: variable_type, value } = targetVar
if (variable_type === VarKindType.variable) {
if (!errorMessage && (!value || value.length === 0))
errorMessage = t(`${i18nPrefix}.fieldRequired`, { field: field.label })
errorMessage = t(`${i18nPrefix}.fieldRequired`, { ns: 'workflow', field: field.label })
}
else {
if (!errorMessage && (value === undefined || value === null || value === ''))
errorMessage = t(`${i18nPrefix}.fieldRequired`, { field: field.label })
errorMessage = t(`${i18nPrefix}.fieldRequired`, { ns: 'workflow', field: field.label })
}
})
}