mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
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:
@ -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 })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user