mirror of https://github.com/langgenius/dify.git
manual change
This commit is contained in:
parent
01d6a6c3ee
commit
6f2663deca
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable dify-i18n/require-ns-option */
|
||||
import * as React from 'react'
|
||||
import Form from '@/app/components/datasets/settings/form'
|
||||
import { getLocaleOnServer, getTranslation } from '@/i18n-config/server'
|
||||
|
|
@ -9,7 +10,7 @@ const Settings = async () => {
|
|||
return (
|
||||
<div className="h-full overflow-y-auto">
|
||||
<div className="flex flex-col gap-y-0.5 px-6 pb-2 pt-3">
|
||||
<div className="system-xl-semibold text-text-primary">{t('title') as any}</div>
|
||||
<div className="system-xl-semibold text-text-primary">{t('title')}</div>
|
||||
<div className="system-sm-regular text-text-tertiary">{t('desc')}</div>
|
||||
</div>
|
||||
<Form />
|
||||
|
|
|
|||
|
|
@ -84,21 +84,21 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
|
|||
})
|
||||
|
||||
const newList = newPromptVariables
|
||||
let errorMsgKey = ''
|
||||
let typeName = ''
|
||||
let errorMsgKey: 'varKeyError.keyAlreadyExists' | '' = ''
|
||||
let typeName: 'variableConfig.varName' | 'variableConfig.labelName' | '' = ''
|
||||
if (hasDuplicateStr(newList.map(item => item.key))) {
|
||||
errorMsgKey = 'appDebug.varKeyError.keyAlreadyExists'
|
||||
typeName = 'appDebug.variableConfig.varName'
|
||||
errorMsgKey = 'varKeyError.keyAlreadyExists'
|
||||
typeName = 'variableConfig.varName'
|
||||
}
|
||||
else if (hasDuplicateStr(newList.map(item => item.name as string))) {
|
||||
errorMsgKey = 'appDebug.varKeyError.keyAlreadyExists'
|
||||
typeName = 'appDebug.variableConfig.labelName'
|
||||
errorMsgKey = 'varKeyError.keyAlreadyExists'
|
||||
typeName = 'variableConfig.labelName'
|
||||
}
|
||||
|
||||
if (errorMsgKey) {
|
||||
if (errorMsgKey && typeName) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
|
||||
message: t(errorMsgKey, { ns: 'appDebug', key: t(typeName, { ns: 'appDebug' }) }),
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const EncryptedBottom = (props: Props) => {
|
|||
return (
|
||||
<div className={cn('system-xs-regular flex items-center justify-center rounded-b-2xl border-t-[0.5px] border-divider-subtle bg-background-soft px-2 py-3 text-text-tertiary', className)}>
|
||||
<RiLock2Fill className="mx-1 h-3 w-3 text-text-quaternary" />
|
||||
{t((frontTextKey || 'common.provider.encrypted.front') as any) as string}
|
||||
{t((frontTextKey || 'provider.encrypted.front') as any, { ns: 'common' })}
|
||||
<Link
|
||||
className="mx-1 text-text-accent"
|
||||
target="_blank"
|
||||
|
|
@ -25,7 +25,7 @@ export const EncryptedBottom = (props: Props) => {
|
|||
>
|
||||
PKCS1_OAEP
|
||||
</Link>
|
||||
{t((backTextKey || 'common.provider.encrypted.back') as any) as string}
|
||||
{t((backTextKey || 'provider.encrypted.back') as any, { ns: 'common' })}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import type { TFunction } from 'i18next'
|
||||
import type { FileEntity } from './types'
|
||||
import type { FileResponse } from '@/types/workflow'
|
||||
import mime from 'mime'
|
||||
|
|
@ -14,7 +15,7 @@ import { FileAppearanceTypeEnum } from './types'
|
|||
* @param t - Translation function
|
||||
* @returns Localized error message
|
||||
*/
|
||||
export const getFileUploadErrorMessage = (error: any, defaultMessage: string, t: (key: string) => string): string => {
|
||||
export const getFileUploadErrorMessage = (error: any, defaultMessage: string, t: TFunction): string => {
|
||||
const errorCode = error?.response?.code
|
||||
|
||||
if (errorCode === 'forbidden')
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import type { TFunction } from 'i18next'
|
||||
import { upload } from '@/service/base'
|
||||
|
||||
/**
|
||||
|
|
@ -7,7 +8,7 @@ import { upload } from '@/service/base'
|
|||
* @param t - Translation function
|
||||
* @returns Localized error message
|
||||
*/
|
||||
export const getImageUploadErrorMessage = (error: any, defaultMessage: string, t: (key: string) => string): string => {
|
||||
export const getImageUploadErrorMessage = (error: any, defaultMessage: string, t: TFunction): string => {
|
||||
const errorCode = error?.response?.code
|
||||
|
||||
if (errorCode === 'forbidden')
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ const TagInput: FC<TagInputProps> = ({
|
|||
setValue(e.target.value)
|
||||
}}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder={t((placeholder || (isSpecialMode ? 'common.model.params.stop_sequencesPlaceholder' : 'datasetDocuments.segment.addKeyWord')) as any)}
|
||||
placeholder={t((placeholder || (isSpecialMode ? 'model.params.stop_sequencesPlaceholder' : 'segment.addKeyWord')) as any, { ns: isSpecialMode ? 'common' : 'datasetDocuments' })}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ const PlanUpgradeModal: FC<Props> = ({
|
|||
isShort
|
||||
onClick={handleUpgrade}
|
||||
className="!h-8 !rounded-lg px-2"
|
||||
labelKey="billing.triggerLimitModal.upgrade"
|
||||
labelKey="triggerLimitModal.upgrade"
|
||||
loc="trigger-events-limit-modal"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ const UpgradeBtn: FC<Props> = ({
|
|||
}
|
||||
}
|
||||
|
||||
const defaultBadgeLabel = t(`upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}` as any, { ns: 'billing' }) as string
|
||||
const label = labelKey ? t(labelKey as any) as string : defaultBadgeLabel
|
||||
const defaultBadgeLabel = t(isShort ? 'upgradeBtn.encourageShort' : 'upgradeBtn.encourage', { ns: 'billing' })
|
||||
const label = labelKey ? t(labelKey as any, { ns: 'billing' }) : defaultBadgeLabel
|
||||
|
||||
if (isPlain) {
|
||||
return (
|
||||
|
|
@ -56,7 +56,7 @@ const UpgradeBtn: FC<Props> = ({
|
|||
style={style}
|
||||
onClick={onClick}
|
||||
>
|
||||
{labelKey ? label : t('upgradeBtn.plain' as any, { ns: 'billing' }) as string}
|
||||
{labelKey ? label : t('upgradeBtn.plain', { ns: 'billing' })}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const UpgradeCard: FC = () => {
|
|||
size="custom"
|
||||
isShort
|
||||
className="ml-3 !h-8 !rounded-lg px-2"
|
||||
labelKey="billing.triggerLimitModal.upgrade"
|
||||
labelKey="triggerLimitModal.upgrade"
|
||||
loc="upload-multiple-files"
|
||||
onClick={handleUpgrade}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ export type TopBarProps = Pick<StepperProps, 'activeIndex'> & {
|
|||
datasetId?: string
|
||||
}
|
||||
|
||||
const STEP_T_MAP: Record<number, string> = {
|
||||
1: 'datasetCreation.steps.one',
|
||||
2: 'datasetCreation.steps.two',
|
||||
3: 'datasetCreation.steps.three',
|
||||
}
|
||||
const STEP_T_MAP = {
|
||||
1: 'steps.one',
|
||||
2: 'steps.two',
|
||||
3: 'steps.three',
|
||||
} as const
|
||||
|
||||
export const TopBar: FC<TopBarProps> = (props) => {
|
||||
const { className, datasetId, ...rest } = props
|
||||
|
|
@ -39,7 +39,7 @@ export const TopBar: FC<TopBarProps> = (props) => {
|
|||
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
<Stepper
|
||||
steps={Array.from({ length: 3 }, (_, i) => ({
|
||||
name: t(STEP_T_MAP[i + 1] as any) as string,
|
||||
name: t(STEP_T_MAP[(i + 1) as keyof typeof STEP_T_MAP], { ns: 'datasetCreation' }),
|
||||
}))}
|
||||
{...rest}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -427,9 +427,9 @@ const Completed: FC<ICompletedProps> = ({
|
|||
const total = segmentListData?.total ? formatNumber(segmentListData.total) : '--'
|
||||
const count = total === '--' ? 0 : segmentListData!.total
|
||||
const translationKey = (docForm === ChunkingMode.parentChild && parentMode === 'paragraph')
|
||||
? 'datasetDocuments.segment.parentChunks'
|
||||
: 'datasetDocuments.segment.chunks'
|
||||
return `${total} ${t(translationKey, { count })}`
|
||||
? 'segment.parentChunks' as const
|
||||
: 'segment.chunks' as const
|
||||
return `${total} ${t(translationKey, { ns: 'datasetDocuments', count })}`
|
||||
}
|
||||
else {
|
||||
const total = typeof segmentListData?.total === 'number' ? formatNumber(segmentListData.total) : 0
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import { ThumbsUp } from '@/app/components/base/icons/src/vender/line/alertsAndF
|
|||
import exploreI18n from '@/i18n/en-US/explore.json'
|
||||
import { cn } from '@/utils/classnames'
|
||||
|
||||
const categoryI18n = exploreI18n.category
|
||||
|
||||
export type ICategoryProps = {
|
||||
className?: string
|
||||
list: AppCategory[]
|
||||
|
|
@ -50,7 +48,7 @@ const Category: FC<ICategoryProps> = ({
|
|||
className={itemClassName(name === value)}
|
||||
onClick={() => onChange(name)}
|
||||
>
|
||||
{(categoryI18n as any)[name] ? t(`category.${name}` as any, { ns: 'explore' }) as string : name}
|
||||
{`category.${name}` in exploreI18n ? t(`category.${name}` as any, { ns: 'explore' }) as string : name}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import type { ReactNode } from 'react'
|
||||
import type { CommandSearchResult } from '../types'
|
||||
import type { SlashCommandHandler } from './types'
|
||||
import { RiComputerLine, RiMoonLine, RiSunLine } from '@remixicon/react'
|
||||
|
|
@ -11,38 +10,38 @@ type ThemeDeps = {
|
|||
setTheme?: (value: 'light' | 'dark' | 'system') => void
|
||||
}
|
||||
|
||||
const THEME_ITEMS: { id: 'light' | 'dark' | 'system', titleKey: string, descKey: string, icon: ReactNode }[] = [
|
||||
const THEME_ITEMS = [
|
||||
{
|
||||
id: 'system',
|
||||
titleKey: 'app.gotoAnything.actions.themeSystem',
|
||||
descKey: 'app.gotoAnything.actions.themeSystemDesc',
|
||||
titleKey: 'gotoAnything.actions.themeSystem',
|
||||
descKey: 'gotoAnything.actions.themeSystemDesc',
|
||||
icon: <RiComputerLine className="h-4 w-4 text-text-tertiary" />,
|
||||
},
|
||||
{
|
||||
id: 'light',
|
||||
titleKey: 'app.gotoAnything.actions.themeLight',
|
||||
descKey: 'app.gotoAnything.actions.themeLightDesc',
|
||||
titleKey: 'gotoAnything.actions.themeLight',
|
||||
descKey: 'gotoAnything.actions.themeLightDesc',
|
||||
icon: <RiSunLine className="h-4 w-4 text-text-tertiary" />,
|
||||
},
|
||||
{
|
||||
id: 'dark',
|
||||
titleKey: 'app.gotoAnything.actions.themeDark',
|
||||
descKey: 'app.gotoAnything.actions.themeDarkDesc',
|
||||
titleKey: 'gotoAnything.actions.themeDark',
|
||||
descKey: 'gotoAnything.actions.themeDarkDesc',
|
||||
icon: <RiMoonLine className="h-4 w-4 text-text-tertiary" />,
|
||||
},
|
||||
]
|
||||
] as const
|
||||
|
||||
const buildThemeCommands = (query: string, locale?: string): CommandSearchResult[] => {
|
||||
const q = query.toLowerCase()
|
||||
const list = THEME_ITEMS.filter(item =>
|
||||
!q
|
||||
|| i18n.t(item.titleKey as any, { lng: locale }).toLowerCase().includes(q)
|
||||
|| i18n.t(item.titleKey, { ns: 'app', lng: locale }).toLowerCase().includes(q)
|
||||
|| item.id.includes(q),
|
||||
)
|
||||
return list.map(item => ({
|
||||
id: item.id,
|
||||
title: i18n.t(item.titleKey as any, { lng: locale }),
|
||||
description: i18n.t(item.descKey as any, { lng: locale }),
|
||||
title: i18n.t(item.titleKey, { ns: 'app', lng: locale }),
|
||||
description: i18n.t(item.descKey, { ns: 'app', lng: locale }),
|
||||
type: 'command' as const,
|
||||
icon: (
|
||||
<div className="flex h-6 w-6 items-center justify-center rounded-md border-[0.5px] border-divider-regular bg-components-panel-bg">
|
||||
|
|
|
|||
|
|
@ -108,27 +108,27 @@ const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, co
|
|||
{isSlashMode
|
||||
? (
|
||||
(() => {
|
||||
const slashKeyMap: Record<string, string> = {
|
||||
'/theme': 'app.gotoAnything.actions.themeCategoryDesc',
|
||||
'/language': 'app.gotoAnything.actions.languageChangeDesc',
|
||||
'/account': 'app.gotoAnything.actions.accountDesc',
|
||||
'/feedback': 'app.gotoAnything.actions.feedbackDesc',
|
||||
'/docs': 'app.gotoAnything.actions.docDesc',
|
||||
'/community': 'app.gotoAnything.actions.communityDesc',
|
||||
'/zen': 'app.gotoAnything.actions.zenDesc',
|
||||
}
|
||||
return t((slashKeyMap[item.key] || item.description) as any)
|
||||
const slashKeyMap = {
|
||||
'/theme': 'gotoAnything.actions.themeCategoryDesc',
|
||||
'/language': 'gotoAnything.actions.languageChangeDesc',
|
||||
'/account': 'gotoAnything.actions.accountDesc',
|
||||
'/feedback': 'gotoAnything.actions.feedbackDesc',
|
||||
'/docs': 'gotoAnything.actions.docDesc',
|
||||
'/community': 'gotoAnything.actions.communityDesc',
|
||||
'/zen': 'gotoAnything.actions.zenDesc',
|
||||
} as const
|
||||
return t(slashKeyMap[item.key as keyof typeof slashKeyMap] || item.description, { ns: 'app' })
|
||||
})()
|
||||
)
|
||||
: (
|
||||
(() => {
|
||||
const keyMap: Record<string, string> = {
|
||||
'@app': 'app.gotoAnything.actions.searchApplicationsDesc',
|
||||
'@plugin': 'app.gotoAnything.actions.searchPluginsDesc',
|
||||
'@knowledge': 'app.gotoAnything.actions.searchKnowledgeBasesDesc',
|
||||
'@node': 'app.gotoAnything.actions.searchWorkflowNodesDesc',
|
||||
}
|
||||
return t(keyMap[item.key] as any) as string
|
||||
const keyMap = {
|
||||
'@app': 'gotoAnything.actions.searchApplicationsDesc',
|
||||
'@plugin': 'gotoAnything.actions.searchPluginsDesc',
|
||||
'@knowledge': 'gotoAnything.actions.searchKnowledgeBasesDesc',
|
||||
'@node': 'gotoAnything.actions.searchWorkflowNodesDesc',
|
||||
} as const
|
||||
return t(keyMap[item.key as keyof typeof keyMap], { ns: 'app' })
|
||||
})()
|
||||
)}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -237,13 +237,13 @@ const GotoAnything: FC<Props> = ({
|
|||
<div className="text-sm font-medium">
|
||||
{isCommandSearch
|
||||
? (() => {
|
||||
const keyMap: Record<string, string> = {
|
||||
app: 'app.gotoAnything.emptyState.noAppsFound',
|
||||
plugin: 'app.gotoAnything.emptyState.noPluginsFound',
|
||||
knowledge: 'app.gotoAnything.emptyState.noKnowledgeBasesFound',
|
||||
node: 'app.gotoAnything.emptyState.noWorkflowNodesFound',
|
||||
}
|
||||
return t((keyMap[commandType] || 'app.gotoAnything.noResults') as any)
|
||||
const keyMap = {
|
||||
app: 'gotoAnything.emptyState.noAppsFound',
|
||||
plugin: 'gotoAnything.emptyState.noPluginsFound',
|
||||
knowledge: 'gotoAnything.emptyState.noKnowledgeBasesFound',
|
||||
node: 'gotoAnything.emptyState.noWorkflowNodesFound',
|
||||
} as const
|
||||
return t(keyMap[commandType as keyof typeof keyMap] || 'gotoAnything.noResults', { ns: 'app' })
|
||||
})()
|
||||
: t('gotoAnything.noResults', { ns: 'app' })}
|
||||
</div>
|
||||
|
|
@ -403,14 +403,14 @@ const GotoAnything: FC<Props> = ({
|
|||
<Command.Group
|
||||
key={groupIndex}
|
||||
heading={(() => {
|
||||
const typeMap: Record<string, string> = {
|
||||
'app': 'app.gotoAnything.groups.apps',
|
||||
'plugin': 'app.gotoAnything.groups.plugins',
|
||||
'knowledge': 'app.gotoAnything.groups.knowledgeBases',
|
||||
'workflow-node': 'app.gotoAnything.groups.workflowNodes',
|
||||
'command': 'app.gotoAnything.groups.commands',
|
||||
}
|
||||
return t((typeMap[type] || `${type}s`) as any)
|
||||
const typeMap = {
|
||||
'app': 'gotoAnything.groups.apps',
|
||||
'plugin': 'gotoAnything.groups.plugins',
|
||||
'knowledge': 'gotoAnything.groups.knowledgeBases',
|
||||
'workflow-node': 'gotoAnything.groups.workflowNodes',
|
||||
'command': 'gotoAnything.groups.commands',
|
||||
} as const
|
||||
return t(typeMap[type as keyof typeof typeMap] || `${type}s`, { ns: 'app' })
|
||||
})()}
|
||||
className="p-2 capitalize text-text-secondary"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable dify-i18n/require-ns-option */
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import {
|
||||
getLocaleOnServer,
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ const CREDENTIAL_TYPE_MAP: Record<SupportedCreationMethods, TriggerCredentialTyp
|
|||
|
||||
const MODAL_TITLE_KEY_MAP: Record<
|
||||
SupportedCreationMethods,
|
||||
'pluginTrigger.modal.apiKey.title' | 'pluginTrigger.modal.oauth.title' | 'pluginTrigger.modal.manual.title'
|
||||
'modal.apiKey.title' | 'modal.oauth.title' | 'modal.manual.title'
|
||||
> = {
|
||||
[SupportedCreationMethods.APIKEY]: 'pluginTrigger.modal.apiKey.title',
|
||||
[SupportedCreationMethods.OAUTH]: 'pluginTrigger.modal.oauth.title',
|
||||
[SupportedCreationMethods.MANUAL]: 'pluginTrigger.modal.manual.title',
|
||||
[SupportedCreationMethods.APIKEY]: 'modal.apiKey.title',
|
||||
[SupportedCreationMethods.OAUTH]: 'modal.oauth.title',
|
||||
[SupportedCreationMethods.MANUAL]: 'modal.manual.title',
|
||||
}
|
||||
|
||||
enum ApiKeyStep {
|
||||
|
|
@ -347,7 +347,7 @@ export const CommonCreateModal = ({ onClose, createType, builder }: Props) => {
|
|||
|
||||
return (
|
||||
<Modal
|
||||
title={t(MODAL_TITLE_KEY_MAP[createType])}
|
||||
title={t(MODAL_TITLE_KEY_MAP[createType], { ns: 'pluginTrigger' })}
|
||||
confirmButtonText={confirmButtonText}
|
||||
onClose={onClose}
|
||||
onCancel={onClose}
|
||||
|
|
|
|||
|
|
@ -31,21 +31,21 @@ const VarList: FC<Props> = ({
|
|||
const newList = produce(list, (draft) => {
|
||||
draft[index] = payload
|
||||
})
|
||||
let errorMsgKey = ''
|
||||
let typeName = ''
|
||||
let errorMsgKey: 'varKeyError.keyAlreadyExists' | '' = ''
|
||||
let typeName: 'variableConfig.varName' | 'variableConfig.labelName' | '' = ''
|
||||
if (hasDuplicateStr(newList.map(item => item.variable))) {
|
||||
errorMsgKey = 'appDebug.varKeyError.keyAlreadyExists'
|
||||
typeName = 'appDebug.variableConfig.varName'
|
||||
errorMsgKey = 'varKeyError.keyAlreadyExists'
|
||||
typeName = 'variableConfig.varName'
|
||||
}
|
||||
else if (hasDuplicateStr(newList.map(item => item.label as string))) {
|
||||
errorMsgKey = 'appDebug.varKeyError.keyAlreadyExists'
|
||||
typeName = 'appDebug.variableConfig.labelName'
|
||||
errorMsgKey = 'varKeyError.keyAlreadyExists'
|
||||
typeName = 'variableConfig.labelName'
|
||||
}
|
||||
|
||||
if (errorMsgKey) {
|
||||
if (errorMsgKey && typeName) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
|
||||
message: t(errorMsgKey, { ns: 'appDebug', key: t(typeName, { ns: 'appDebug' }) }),
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,21 +85,21 @@ const useConfig = (id: string, payload: StartNodeType) => {
|
|||
draft.variables.push(payload)
|
||||
})
|
||||
const newList = newInputs.variables
|
||||
let errorMsgKey = ''
|
||||
let typeName = ''
|
||||
let errorMsgKey: 'varKeyError.keyAlreadyExists' | '' = ''
|
||||
let typeName: 'variableConfig.varName' | 'variableConfig.labelName' | '' = ''
|
||||
if (hasDuplicateStr(newList.map(item => item.variable))) {
|
||||
errorMsgKey = 'appDebug.varKeyError.keyAlreadyExists'
|
||||
typeName = 'appDebug.variableConfig.varName'
|
||||
errorMsgKey = 'varKeyError.keyAlreadyExists'
|
||||
typeName = 'variableConfig.varName'
|
||||
}
|
||||
else if (hasDuplicateStr(newList.map(item => item.label as string))) {
|
||||
errorMsgKey = 'appDebug.varKeyError.keyAlreadyExists'
|
||||
typeName = 'appDebug.variableConfig.labelName'
|
||||
errorMsgKey = 'varKeyError.keyAlreadyExists'
|
||||
typeName = 'variableConfig.labelName'
|
||||
}
|
||||
|
||||
if (errorMsgKey) {
|
||||
if (errorMsgKey && typeName) {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
|
||||
message: t(errorMsgKey, { ns: 'appDebug', key: t(typeName, { ns: 'appDebug' }) }),
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import { BlockEnum } from '@/app/components/workflow/types'
|
|||
import { genNodeMetaData } from '@/app/components/workflow/utils'
|
||||
import { VarType } from '../../types'
|
||||
|
||||
const i18nPrefix = ''
|
||||
|
||||
const metaData = genNodeMetaData({
|
||||
classification: BlockClassificationEnum.Transform,
|
||||
sort: 3,
|
||||
|
|
@ -23,28 +21,28 @@ const nodeDefault: NodeDefault<VariableAssignerNodeType> = {
|
|||
const { variables, advanced_settings } = payload
|
||||
const { group_enabled = false, groups = [] } = advanced_settings || {}
|
||||
// enable group
|
||||
const validateVariables = (variables: any[], field: string) => {
|
||||
const validateVariables = (variables: any[], field: 'errorMsg.fields.variableValue') => {
|
||||
variables.forEach((variable) => {
|
||||
if (!variable || variable.length === 0)
|
||||
errorMessages = t(`${i18nPrefix}errorMsg.fieldRequired`, { ns: 'workflow', field: t(field) })
|
||||
errorMessages = t('errorMsg.fieldRequired', { ns: 'workflow', field: t(field, { ns: 'workflow' }) })
|
||||
})
|
||||
}
|
||||
|
||||
if (group_enabled) {
|
||||
if (!groups || groups.length === 0) {
|
||||
errorMessages = t(`${i18nPrefix}errorMsg.fieldRequired`, { ns: 'workflow', field: t(`${i18nPrefix}nodes.variableAssigner.title`, { ns: 'workflow' }) })
|
||||
errorMessages = t('errorMsg.fieldRequired', { ns: 'workflow', field: t('nodes.variableAssigner.title', { ns: 'workflow' }) })
|
||||
}
|
||||
else if (!errorMessages) {
|
||||
groups.forEach((group) => {
|
||||
validateVariables(group.variables || [], `${i18nPrefix}.errorMsg.fields.variableValue`)
|
||||
validateVariables(group.variables || [], 'errorMsg.fields.variableValue')
|
||||
})
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!variables || variables.length === 0)
|
||||
errorMessages = t(`${i18nPrefix}errorMsg.fieldRequired`, { ns: 'workflow', field: t(`${i18nPrefix}nodes.variableAssigner.title`, { ns: 'workflow' }) })
|
||||
errorMessages = t('errorMsg.fieldRequired', { ns: 'workflow', field: t('nodes.variableAssigner.title', { ns: 'workflow' }) })
|
||||
else if (!errorMessages)
|
||||
validateVariables(variables, `${i18nPrefix}.errorMsg.fields.variableValue`)
|
||||
validateVariables(variables, 'errorMsg.fields.variableValue')
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import Loading from '../components/base/loading'
|
|||
const accountFormSchema = z.object({
|
||||
email: z
|
||||
.string()
|
||||
.min(1, { message: 'login.error.emailInValid' })
|
||||
.email('login.error.emailInValid'),
|
||||
.min(1, { message: 'error.emailInValid' })
|
||||
.email('error.emailInValid'),
|
||||
})
|
||||
|
||||
type AccountFormValues = z.infer<typeof accountFormSchema>
|
||||
|
|
@ -108,7 +108,7 @@ const ForgotPasswordForm = () => {
|
|||
{...register('email')}
|
||||
placeholder={t('emailPlaceholder', { ns: 'login' }) || ''}
|
||||
/>
|
||||
{errors.email && <span className="text-sm text-red-400">{t(`${errors.email?.message}` as any) as string}</span>}
|
||||
{errors.email && <span className="text-sm text-red-400">{t(`${errors.email?.message}` as any, { ns: 'login' })}</span>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ import Loading from '../components/base/loading'
|
|||
const accountFormSchema = z.object({
|
||||
email: z
|
||||
.string()
|
||||
.min(1, { message: 'login.error.emailInValid' })
|
||||
.email('login.error.emailInValid'),
|
||||
name: z.string().min(1, { message: 'login.error.nameEmpty' }),
|
||||
.min(1, { message: 'error.emailInValid' })
|
||||
.email('error.emailInValid'),
|
||||
name: z.string().min(1, { message: 'error.nameEmpty' }),
|
||||
password: z.string().min(8, {
|
||||
message: 'login.error.passwordLengthInValid',
|
||||
}).regex(validPassword, 'login.error.passwordInvalid'),
|
||||
message: 'error.passwordLengthInValid',
|
||||
}).regex(validPassword, 'error.passwordInvalid'),
|
||||
})
|
||||
|
||||
type AccountFormValues = z.infer<typeof accountFormSchema>
|
||||
|
|
@ -138,7 +138,7 @@ const InstallForm = () => {
|
|||
placeholder={t('emailPlaceholder', { ns: 'login' }) || ''}
|
||||
className="system-sm-regular w-full appearance-none rounded-md border border-transparent bg-components-input-bg-normal px-3 py-[7px] text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs"
|
||||
/>
|
||||
{errors.email && <span className="text-sm text-red-400">{t(`${errors.email?.message}` as any) as string}</span>}
|
||||
{errors.email && <span className="text-sm text-red-400">{t(`${errors.email?.message}` as any, { ns: 'login' })}</span>}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -154,7 +154,7 @@ const InstallForm = () => {
|
|||
className="system-sm-regular w-full appearance-none rounded-md border border-transparent bg-components-input-bg-normal px-3 py-[7px] text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs"
|
||||
/>
|
||||
</div>
|
||||
{errors.name && <span className="text-sm text-red-400">{t(`${errors.name.message}` as any) as string}</span>}
|
||||
{errors.name && <span className="text-sm text-red-400">{t(`${errors.name.message}` as any, { ns: 'login' })}</span>}
|
||||
</div>
|
||||
|
||||
<div className="mb-5">
|
||||
|
|
|
|||
Loading…
Reference in New Issue