From 6f2663deca22e6718026aec18534bb14403516e6 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Fri, 26 Dec 2025 16:52:19 +0800 Subject: [PATCH] manual change --- .../[datasetId]/settings/page.tsx | 3 +- .../app/configuration/config-var/index.tsx | 16 ++++----- .../base/encrypted-bottom/index.tsx | 4 +-- .../components/base/file-uploader/utils.ts | 3 +- .../components/base/image-uploader/utils.ts | 3 +- web/app/components/base/tag-input/index.tsx | 2 +- .../billing/plan-upgrade-modal/index.tsx | 2 +- .../components/billing/upgrade-btn/index.tsx | 6 ++-- .../datasets/create/step-one/upgrade-card.tsx | 2 +- .../datasets/create/top-bar/index.tsx | 12 +++---- .../documents/detail/completed/index.tsx | 6 ++-- web/app/components/explore/category.tsx | 4 +-- .../goto-anything/actions/commands/theme.tsx | 23 ++++++------- .../goto-anything/command-selector.tsx | 34 +++++++++---------- web/app/components/goto-anything/index.tsx | 30 ++++++++-------- .../plugins/marketplace/description/index.tsx | 1 + .../subscription-list/create/common-modal.tsx | 10 +++--- .../nodes/start/components/var-list.tsx | 16 ++++----- .../workflow/nodes/start/use-config.ts | 16 ++++----- .../nodes/variable-assigner/default.ts | 14 ++++---- .../forgot-password/ForgotPasswordForm.tsx | 6 ++-- web/app/install/installForm.tsx | 14 ++++---- 22 files changed, 113 insertions(+), 114 deletions(-) diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx index aa64df3449..8080b565cd 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx @@ -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 (
-
{t('title') as any}
+
{t('title')}
{t('desc')}
diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsx index e3b7c42e1f..b26664401b 100644 --- a/web/app/components/app/configuration/config-var/index.tsx +++ b/web/app/components/app/configuration/config-var/index.tsx @@ -84,21 +84,21 @@ const ConfigVar: FC = ({ 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 } diff --git a/web/app/components/base/encrypted-bottom/index.tsx b/web/app/components/base/encrypted-bottom/index.tsx index 75b3b8151d..5c821c65c4 100644 --- a/web/app/components/base/encrypted-bottom/index.tsx +++ b/web/app/components/base/encrypted-bottom/index.tsx @@ -16,7 +16,7 @@ export const EncryptedBottom = (props: Props) => { return (
- {t((frontTextKey || 'common.provider.encrypted.front') as any) as string} + {t((frontTextKey || 'provider.encrypted.front') as any, { ns: 'common' })} { > PKCS1_OAEP - {t((backTextKey || 'common.provider.encrypted.back') as any) as string} + {t((backTextKey || 'provider.encrypted.back') as any, { ns: 'common' })}
) } diff --git a/web/app/components/base/file-uploader/utils.ts b/web/app/components/base/file-uploader/utils.ts index c85bcb1ff2..5d5754b8fe 100644 --- a/web/app/components/base/file-uploader/utils.ts +++ b/web/app/components/base/file-uploader/utils.ts @@ -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') diff --git a/web/app/components/base/image-uploader/utils.ts b/web/app/components/base/image-uploader/utils.ts index 594eac6348..1773aa0976 100644 --- a/web/app/components/base/image-uploader/utils.ts +++ b/web/app/components/base/image-uploader/utils.ts @@ -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') diff --git a/web/app/components/base/tag-input/index.tsx b/web/app/components/base/tag-input/index.tsx index 8af3802c2d..3dc45406d5 100644 --- a/web/app/components/base/tag-input/index.tsx +++ b/web/app/components/base/tag-input/index.tsx @@ -127,7 +127,7 @@ const TagInput: FC = ({ 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' })} />
) diff --git a/web/app/components/billing/plan-upgrade-modal/index.tsx b/web/app/components/billing/plan-upgrade-modal/index.tsx index be81f04200..17a50e89ad 100644 --- a/web/app/components/billing/plan-upgrade-modal/index.tsx +++ b/web/app/components/billing/plan-upgrade-modal/index.tsx @@ -80,7 +80,7 @@ const PlanUpgradeModal: FC = ({ isShort onClick={handleUpgrade} className="!h-8 !rounded-lg px-2" - labelKey="billing.triggerLimitModal.upgrade" + labelKey="triggerLimitModal.upgrade" loc="trigger-events-limit-modal" /> diff --git a/web/app/components/billing/upgrade-btn/index.tsx b/web/app/components/billing/upgrade-btn/index.tsx index 87dc011a2e..b23ab84580 100644 --- a/web/app/components/billing/upgrade-btn/index.tsx +++ b/web/app/components/billing/upgrade-btn/index.tsx @@ -46,8 +46,8 @@ const UpgradeBtn: FC = ({ } } - 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 = ({ style={style} onClick={onClick} > - {labelKey ? label : t('upgradeBtn.plain' as any, { ns: 'billing' }) as string} + {labelKey ? label : t('upgradeBtn.plain', { ns: 'billing' })} ) } diff --git a/web/app/components/datasets/create/step-one/upgrade-card.tsx b/web/app/components/datasets/create/step-one/upgrade-card.tsx index cff9980dc5..7624966bd3 100644 --- a/web/app/components/datasets/create/step-one/upgrade-card.tsx +++ b/web/app/components/datasets/create/step-one/upgrade-card.tsx @@ -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} /> diff --git a/web/app/components/datasets/create/top-bar/index.tsx b/web/app/components/datasets/create/top-bar/index.tsx index 5feb206a5e..0051430511 100644 --- a/web/app/components/datasets/create/top-bar/index.tsx +++ b/web/app/components/datasets/create/top-bar/index.tsx @@ -12,11 +12,11 @@ export type TopBarProps = Pick & { datasetId?: string } -const STEP_T_MAP: Record = { - 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 = (props) => { const { className, datasetId, ...rest } = props @@ -39,7 +39,7 @@ export const TopBar: FC = (props) => {
({ - 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} /> diff --git a/web/app/components/datasets/documents/detail/completed/index.tsx b/web/app/components/datasets/documents/detail/completed/index.tsx index e27fa9cabb..531603a1cf 100644 --- a/web/app/components/datasets/documents/detail/completed/index.tsx +++ b/web/app/components/datasets/documents/detail/completed/index.tsx @@ -427,9 +427,9 @@ const Completed: FC = ({ 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 diff --git a/web/app/components/explore/category.tsx b/web/app/components/explore/category.tsx index 0e507b457f..57728def27 100644 --- a/web/app/components/explore/category.tsx +++ b/web/app/components/explore/category.tsx @@ -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 = ({ 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}
))} diff --git a/web/app/components/goto-anything/actions/commands/theme.tsx b/web/app/components/goto-anything/actions/commands/theme.tsx index 34df84e33b..335182af67 100644 --- a/web/app/components/goto-anything/actions/commands/theme.tsx +++ b/web/app/components/goto-anything/actions/commands/theme.tsx @@ -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: , }, { id: 'light', - titleKey: 'app.gotoAnything.actions.themeLight', - descKey: 'app.gotoAnything.actions.themeLightDesc', + titleKey: 'gotoAnything.actions.themeLight', + descKey: 'gotoAnything.actions.themeLightDesc', icon: , }, { id: 'dark', - titleKey: 'app.gotoAnything.actions.themeDark', - descKey: 'app.gotoAnything.actions.themeDarkDesc', + titleKey: 'gotoAnything.actions.themeDark', + descKey: 'gotoAnything.actions.themeDarkDesc', icon: , }, -] +] 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: (
diff --git a/web/app/components/goto-anything/command-selector.tsx b/web/app/components/goto-anything/command-selector.tsx index a5593d2a6f..bdb641cae6 100644 --- a/web/app/components/goto-anything/command-selector.tsx +++ b/web/app/components/goto-anything/command-selector.tsx @@ -108,27 +108,27 @@ const CommandSelector: FC = ({ actions, onCommandSelect, searchFilter, co {isSlashMode ? ( (() => { - const slashKeyMap: Record = { - '/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 = { - '@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' }) })() )} diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsx index b24e858c25..30add3480d 100644 --- a/web/app/components/goto-anything/index.tsx +++ b/web/app/components/goto-anything/index.tsx @@ -237,13 +237,13 @@ const GotoAnything: FC = ({
{isCommandSearch ? (() => { - const keyMap: Record = { - 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' })}
@@ -403,14 +403,14 @@ const GotoAnything: FC = ({ { - const typeMap: Record = { - '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" > diff --git a/web/app/components/plugins/marketplace/description/index.tsx b/web/app/components/plugins/marketplace/description/index.tsx index 66a6368c08..9a0850d127 100644 --- a/web/app/components/plugins/marketplace/description/index.tsx +++ b/web/app/components/plugins/marketplace/description/index.tsx @@ -1,3 +1,4 @@ +/* eslint-disable dify-i18n/require-ns-option */ import type { Locale } from '@/i18n-config' import { getLocaleOnServer, diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx index c682f21504..91a844fb86 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx @@ -42,11 +42,11 @@ const CREDENTIAL_TYPE_MAP: Record = { - [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 ( = ({ 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 } diff --git a/web/app/components/workflow/nodes/start/use-config.ts b/web/app/components/workflow/nodes/start/use-config.ts index e563e710ce..232c788b6d 100644 --- a/web/app/components/workflow/nodes/start/use-config.ts +++ b/web/app/components/workflow/nodes/start/use-config.ts @@ -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 } diff --git a/web/app/components/workflow/nodes/variable-assigner/default.ts b/web/app/components/workflow/nodes/variable-assigner/default.ts index 7ee1736570..800fb74e36 100644 --- a/web/app/components/workflow/nodes/variable-assigner/default.ts +++ b/web/app/components/workflow/nodes/variable-assigner/default.ts @@ -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 = { 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 { diff --git a/web/app/forgot-password/ForgotPasswordForm.tsx b/web/app/forgot-password/ForgotPasswordForm.tsx index d41815dd52..0fc4fa9c5d 100644 --- a/web/app/forgot-password/ForgotPasswordForm.tsx +++ b/web/app/forgot-password/ForgotPasswordForm.tsx @@ -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 @@ -108,7 +108,7 @@ const ForgotPasswordForm = () => { {...register('email')} placeholder={t('emailPlaceholder', { ns: 'login' }) || ''} /> - {errors.email && {t(`${errors.email?.message}` as any) as string}} + {errors.email && {t(`${errors.email?.message}` as any, { ns: 'login' })}}
)} diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx index bfd0549abe..29f419e8d0 100644 --- a/web/app/install/installForm.tsx +++ b/web/app/install/installForm.tsx @@ -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 @@ -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 && {t(`${errors.email?.message}` as any) as string}} + {errors.email && {t(`${errors.email?.message}` as any, { ns: 'login' })}} @@ -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" /> - {errors.name && {t(`${errors.name.message}` as any) as string}} + {errors.name && {t(`${errors.name.message}` as any, { ns: 'login' })}}