chore: fix type check for i18n (#30058)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
Stephen Zhou 2025-12-24 16:31:16 +08:00 committed by GitHub
parent 0f41924db4
commit 1e3823e605
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
155 changed files with 560 additions and 1015 deletions

View File

@ -1,4 +1,4 @@
name: Check i18n Files and Create PR name: Translate i18n Files Based on English
on: on:
push: push:
@ -67,25 +67,19 @@ jobs:
working-directory: ./web working-directory: ./web
run: pnpm run auto-gen-i18n ${{ env.FILE_ARGS }} run: pnpm run auto-gen-i18n ${{ env.FILE_ARGS }}
- name: Generate i18n type definitions
if: env.FILES_CHANGED == 'true'
working-directory: ./web
run: pnpm run gen:i18n-types
- name: Create Pull Request - name: Create Pull Request
if: env.FILES_CHANGED == 'true' if: env.FILES_CHANGED == 'true'
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore(i18n): update translations based on en-US changes' commit-message: 'chore(i18n): update translations based on en-US changes'
title: 'chore(i18n): translate i18n files and update type definitions' title: 'chore(i18n): translate i18n files based on en-US changes'
body: | body: |
This PR was automatically created to update i18n files and TypeScript type definitions based on changes in en-US locale. This PR was automatically created to update i18n translation files based on changes in en-US locale.
**Triggered by:** ${{ github.sha }} **Triggered by:** ${{ github.sha }}
**Changes included:** **Changes included:**
- Updated translation files for all locales - Updated translation files for all locales
- Regenerated TypeScript type definitions for type safety
branch: chore/automated-i18n-updates-${{ github.sha }} branch: chore/automated-i18n-updates-${{ github.sha }}
delete-branch: true delete-branch: true

View File

@ -38,9 +38,6 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Check i18n types synchronization
run: pnpm run check:i18n-types
- name: Run tests - name: Run tests
run: pnpm test:coverage run: pnpm test:coverage

View File

@ -104,7 +104,7 @@ const CardView: FC<ICardViewProps> = ({ appId, isInPanel, className }) => {
notify({ notify({
type, type,
message: t(`common.actionMsg.${message}`), message: t(`common.actionMsg.${message}` as any) as string,
}) })
} }

View File

@ -53,7 +53,7 @@ const LongTimeRangePicker: FC<Props> = ({
return ( return (
<SimpleSelect <SimpleSelect
items={Object.entries(periodMapping).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}`) }))} items={Object.entries(periodMapping).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
className="mt-0 !w-40" className="mt-0 !w-40"
notClearable={true} notClearable={true}
onSelect={handleSelect} onSelect={handleSelect}

View File

@ -66,7 +66,7 @@ const RangeSelector: FC<Props> = ({
}, []) }, [])
return ( return (
<SimpleSelect <SimpleSelect
items={ranges.map(v => ({ ...v, name: t(`appLog.filter.period.${v.name}`) }))} items={ranges.map(v => ({ ...v, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
className="mt-0 !w-40" className="mt-0 !w-40"
notClearable={true} notClearable={true}
onSelect={handleSelectRange} onSelect={handleSelectRange}

View File

@ -1,15 +1,15 @@
import * as React from 'react' import * as React from 'react'
import Form from '@/app/components/datasets/settings/form' import Form from '@/app/components/datasets/settings/form'
import { getLocaleOnServer, useTranslation as translate } from '@/i18n-config/server' import { getLocaleOnServer, getTranslation } from '@/i18n-config/server'
const Settings = async () => { const Settings = async () => {
const locale = await getLocaleOnServer() const locale = await getLocaleOnServer()
const { t } = await translate(locale, 'dataset-settings') const { t } = await getTranslation(locale, 'dataset-settings')
return ( return (
<div className="h-full overflow-y-auto"> <div className="h-full overflow-y-auto">
<div className="flex flex-col gap-y-0.5 px-6 pb-2 pt-3"> <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')}</div> <div className="system-xl-semibold text-text-primary">{t('title') as any}</div>
<div className="system-sm-regular text-text-tertiary">{t('desc')}</div> <div className="system-sm-regular text-text-tertiary">{t('desc')}</div>
</div> </div>
<Form /> <Form />

View File

@ -73,7 +73,7 @@ const DatasetInfo: FC<DatasetInfoProps> = ({
{isExternalProvider && t('dataset.externalTag')} {isExternalProvider && t('dataset.externalTag')}
{!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique && ( {!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique && (
<div className="flex items-center gap-x-2"> <div className="flex items-center gap-x-2">
<span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)}</span> <span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}</span>
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span> <span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
</div> </div>
)} )}

View File

@ -116,7 +116,7 @@ const DatasetSidebarDropdown = ({
{isExternalProvider && t('dataset.externalTag')} {isExternalProvider && t('dataset.externalTag')}
{!isExternalProvider && dataset.doc_form && dataset.indexing_technique && ( {!isExternalProvider && dataset.doc_form && dataset.indexing_technique && (
<div className="flex items-center gap-x-2"> <div className="flex items-center gap-x-2">
<span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)}</span> <span>{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}</span>
<span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span> <span>{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)}</span>
</div> </div>
)} )}

View File

@ -1,5 +1,6 @@
import type { ComponentProps } from 'react' import type { ComponentProps } from 'react'
import type { AnnotationItemBasic } from '../type' import type { AnnotationItemBasic } from '../type'
import type { Locale } from '@/i18n-config'
import { render, screen, waitFor } from '@testing-library/react' import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event' import userEvent from '@testing-library/user-event'
import * as React from 'react' import * as React from 'react'
@ -166,7 +167,7 @@ type HeaderOptionsProps = ComponentProps<typeof HeaderOptions>
const renderComponent = ( const renderComponent = (
props: Partial<HeaderOptionsProps> = {}, props: Partial<HeaderOptionsProps> = {},
locale: string = LanguagesSupported[0] as string, locale: Locale = LanguagesSupported[0],
) => { ) => {
const defaultProps: HeaderOptionsProps = { const defaultProps: HeaderOptionsProps = {
appId: 'test-app-id', appId: 'test-app-id',
@ -353,7 +354,7 @@ describe('HeaderOptions', () => {
}) })
const revokeSpy = vi.spyOn(URL, 'revokeObjectURL').mockImplementation(vi.fn()) const revokeSpy = vi.spyOn(URL, 'revokeObjectURL').mockImplementation(vi.fn())
renderComponent({}, LanguagesSupported[1] as string) renderComponent({}, LanguagesSupported[1])
await expandExportMenu(user) await expandExportMenu(user)
@ -441,7 +442,7 @@ describe('HeaderOptions', () => {
view.rerender( view.rerender(
<I18NContext.Provider <I18NContext.Provider
value={{ value={{
locale: LanguagesSupported[0] as string, locale: LanguagesSupported[0],
i18n: {}, i18n: {},
setLocaleOnClient: vi.fn(), setLocaleOnClient: vi.fn(),
}} }}

View File

@ -84,7 +84,7 @@ const AccessModeDisplay: React.FC<{ mode?: AccessMode }> = ({ mode }) => {
<> <>
<Icon className="h-4 w-4 shrink-0 text-text-secondary" /> <Icon className="h-4 w-4 shrink-0 text-text-secondary" />
<div className="grow truncate"> <div className="grow truncate">
<span className="system-sm-medium text-text-secondary">{t(`app.accessControlDialog.accessItems.${label}`)}</span> <span className="system-sm-medium text-text-secondary">{t(`app.accessControlDialog.accessItems.${label}` as any) as string}</span>
</div> </div>
</> </>
) )

View File

@ -96,7 +96,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
if (!isValid) { if (!isValid) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: t('appDebug.variableConfig.varName') }), message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: t('appDebug.variableConfig.varName') }) as string,
}) })
return false return false
} }
@ -216,7 +216,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
if (!isValid) { if (!isValid) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }), message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }) as string,
}) })
return return
} }

View File

@ -98,7 +98,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
if (errorMsgKey) { if (errorMsgKey) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(errorMsgKey, { key: t(typeName) }), message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
}) })
return false return false
} }

View File

@ -23,7 +23,7 @@ const SelectTypeItem: FC<ISelectTypeItemProps> = ({
onClick, onClick,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const typeName = t(`appDebug.variableConfig.${i18nFileTypeMap[type] || type}`) const typeName = t(`appDebug.variableConfig.${i18nFileTypeMap[type] || type}` as any) as string
return ( return (
<div <div

View File

@ -141,7 +141,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
const [editorKey, setEditorKey] = useState(`${flowId}-0`) const [editorKey, setEditorKey] = useState(`${flowId}-0`)
const handleChooseTemplate = useCallback((key: string) => { const handleChooseTemplate = useCallback((key: string) => {
return () => { return () => {
const template = t(`appDebug.generate.template.${key}.instruction`) const template = t(`appDebug.generate.template.${key}.instruction` as any) as string
setInstruction(template) setInstruction(template)
setEditorKey(`${flowId}-${Date.now()}`) setEditorKey(`${flowId}-${Date.now()}`)
} }
@ -322,7 +322,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
<TryLabel <TryLabel
key={item.key} key={item.key}
Icon={item.icon} Icon={item.icon}
text={t(`appDebug.generate.template.${item.key}.name`)} text={t(`appDebug.generate.template.${item.key}.name` as any) as string}
onClick={handleChooseTemplate(item.key)} onClick={handleChooseTemplate(item.key)}
/> />
))} ))}

View File

@ -295,7 +295,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
isExternal isExternal
rowClass={rowClass} rowClass={rowClass}
labelClass={labelClass} labelClass={labelClass}
t={t} t={t as any}
topK={topK} topK={topK}
scoreThreshold={scoreThreshold} scoreThreshold={scoreThreshold}
scoreThresholdEnabled={scoreThresholdEnabled} scoreThresholdEnabled={scoreThresholdEnabled}
@ -308,7 +308,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
isExternal={false} isExternal={false}
rowClass={rowClass} rowClass={rowClass}
labelClass={labelClass} labelClass={labelClass}
t={t} t={t as any}
indexMethod={indexMethod} indexMethod={indexMethod}
retrievalConfig={retrievalConfig} retrievalConfig={retrievalConfig}
showMultiModalTip={showMultiModalTip} showMultiModalTip={showMultiModalTip}

View File

@ -50,7 +50,7 @@ const Filter: FC<IFilterProps> = ({ isChatMode, appId, queryParams, setQueryPara
setQueryParams({ ...queryParams, period: item.value }) setQueryParams({ ...queryParams, period: item.value })
}} }}
onClear={() => setQueryParams({ ...queryParams, period: '9' })} onClear={() => setQueryParams({ ...queryParams, period: '9' })}
items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}`) }))} items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
/> />
<Chip <Chip
className="min-w-[150px]" className="min-w-[150px]"

View File

@ -55,7 +55,7 @@ const Filter: FC<IFilterProps> = ({ queryParams, setQueryParams }: IFilterProps)
setQueryParams({ ...queryParams, period: item.value }) setQueryParams({ ...queryParams, period: item.value })
}} }}
onClear={() => setQueryParams({ ...queryParams, period: '9' })} onClear={() => setQueryParams({ ...queryParams, period: '9' })}
items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}`) }))} items={Object.entries(TIME_PERIOD_MAPPING).map(([k, v]) => ({ value: k, name: t(`appLog.filter.period.${v.name}` as any) as string }))}
/> />
<Input <Input
wrapperClassName="w-[200px]" wrapperClassName="w-[200px]"

View File

@ -94,7 +94,7 @@ const BlockInput: FC<IBlockInputProps> = ({
if (!isValid) { if (!isValid) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }), message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }) as string,
}) })
return return
} }

View File

@ -3,6 +3,7 @@ import type {
ChatItem, ChatItem,
Feedback, Feedback,
} from '../types' } from '../types'
import type { Locale } from '@/i18n-config'
import type { import type {
// AppData, // AppData,
ConversationItem, ConversationItem,
@ -93,7 +94,7 @@ export const useEmbeddedChatbot = () => {
if (localeParam) { if (localeParam) {
// If locale parameter exists in URL, use it instead of default // If locale parameter exists in URL, use it instead of default
await changeLanguage(localeParam) await changeLanguage(localeParam as Locale)
} }
else if (localeFromSysVar) { else if (localeFromSysVar) {
// If locale is set as a system variable, use that // If locale is set as a system variable, use that

View File

@ -6,7 +6,7 @@ const YEAR_RANGE = 100
export const useDaysOfWeek = () => { export const useDaysOfWeek = () => {
const { t } = useTranslation() const { t } = useTranslation()
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map(day => t(`time.daysInWeek.${day}`)) const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map(day => t(`time.daysInWeek.${day}` as any) as string)
return daysOfWeek return daysOfWeek
} }
@ -26,7 +26,7 @@ export const useMonths = () => {
'October', 'October',
'November', 'November',
'December', 'December',
].map(month => t(`time.months.${month}`)) ].map(month => t(`time.months.${month}` as any) as string)
return months return months
} }

View File

@ -16,7 +16,7 @@ export const EncryptedBottom = (props: Props) => {
return ( 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)}> <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" /> <RiLock2Fill className="mx-1 h-3 w-3 text-text-quaternary" />
{t(frontTextKey || 'common.provider.encrypted.front')} {t((frontTextKey || 'common.provider.encrypted.front') as any) as string}
<Link <Link
className="mx-1 text-text-accent" className="mx-1 text-text-accent"
target="_blank" target="_blank"
@ -25,7 +25,7 @@ export const EncryptedBottom = (props: Props) => {
> >
PKCS1_OAEP PKCS1_OAEP
</Link> </Link>
{t(backTextKey || 'common.provider.encrypted.back')} {t((backTextKey || 'common.provider.encrypted.back') as any) as string}
</div> </div>
) )
} }

View File

@ -97,7 +97,7 @@ const VoiceParamConfig = ({
className="h-full w-full cursor-pointer rounded-lg border-0 bg-components-input-bg-normal py-1.5 pl-3 pr-10 focus-visible:bg-state-base-hover focus-visible:outline-none group-hover:bg-state-base-hover sm:text-sm sm:leading-6" className="h-full w-full cursor-pointer rounded-lg border-0 bg-components-input-bg-normal py-1.5 pl-3 pr-10 focus-visible:bg-state-base-hover focus-visible:outline-none group-hover:bg-state-base-hover sm:text-sm sm:leading-6"
> >
<span className={cn('block truncate text-left text-text-secondary', !languageItem?.name && 'text-text-tertiary')}> <span className={cn('block truncate text-left text-text-secondary', !languageItem?.name && 'text-text-tertiary')}>
{languageItem?.name ? t(`common.voice.language.${languageItem?.value.replace('-', '')}`) : localLanguagePlaceholder} {languageItem?.name ? t(`common.voice.language.${languageItem?.value.replace('-', '')}` as any) as string : localLanguagePlaceholder}
</span> </span>
<span className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"> <span className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
<ChevronDownIcon <ChevronDownIcon
@ -128,7 +128,7 @@ const VoiceParamConfig = ({
<span <span
className={cn('block', selected && 'font-normal')} className={cn('block', selected && 'font-normal')}
> >
{t(`common.voice.language.${(item.value).toString().replace('-', '')}`)} {t(`common.voice.language.${(item.value).toString().replace('-', '')}` as any) as string}
</span> </span>
{(selected || item.value === text2speech?.language) && ( {(selected || item.value === text2speech?.language) && (
<span <span

View File

@ -174,7 +174,7 @@ export const useFile = (fileConfig: FileUpload, noNeedToCheckEnable = true) => {
handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 }) handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 })
}, },
onErrorCallback: (error?: any) => { onErrorCallback: (error?: any) => {
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t) const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
handleUpdateFile({ ...uploadingFile, progress: -1 }) handleUpdateFile({ ...uploadingFile, progress: -1 })
}, },
@ -287,7 +287,7 @@ export const useFile = (fileConfig: FileUpload, noNeedToCheckEnable = true) => {
handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 }) handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 })
}, },
onErrorCallback: (error?: any) => { onErrorCallback: (error?: any) => {
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t) const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
handleUpdateFile({ ...uploadingFile, progress: -1 }) handleUpdateFile({ ...uploadingFile, progress: -1 })
}, },

View File

@ -44,7 +44,7 @@ export const useInputTypeOptions = (supportFile: boolean) => {
return options.map((value) => { return options.map((value) => {
return { return {
value, value,
label: t(`appDebug.variableConfig.${i18nFileTypeMap[value] || value}`), label: t(`appDebug.variableConfig.${i18nFileTypeMap[value] || value}` as any),
Icon: INPUT_TYPE_ICON[value], Icon: INPUT_TYPE_ICON[value],
type: DATA_TYPE[value], type: DATA_TYPE[value],
} }

View File

@ -82,7 +82,7 @@ export const useImageFiles = () => {
setFiles(newFiles) setFiles(newFiles)
}, },
onErrorCallback: (error?: any) => { onErrorCallback: (error?: any) => {
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t) const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
const newFiles = [...files.slice(0, index), { ...currentImageFile, progress: -1 }, ...files.slice(index + 1)] const newFiles = [...files.slice(0, index), { ...currentImageFile, progress: -1 }, ...files.slice(index + 1)]
filesRef.current = newFiles filesRef.current = newFiles
@ -160,7 +160,7 @@ export const useLocalFileUploader = ({ limit, disabled = false, onUpload }: useL
onUpload({ ...imageFile, fileId: res.id, progress: 100 }) onUpload({ ...imageFile, fileId: res.id, progress: 100 })
}, },
onErrorCallback: (error?: any) => { onErrorCallback: (error?: any) => {
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t) const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
onUpload({ ...imageFile, progress: -1 }) onUpload({ ...imageFile, progress: -1 })
}, },

View File

@ -127,7 +127,7 @@ const TagInput: FC<TagInputProps> = ({
setValue(e.target.value) setValue(e.target.value)
}} }}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
placeholder={t(placeholder || (isSpecialMode ? 'common.model.params.stop_sequencesPlaceholder' : 'datasetDocuments.segment.addKeyWord'))} placeholder={t((placeholder || (isSpecialMode ? 'common.model.params.stop_sequencesPlaceholder' : 'datasetDocuments.segment.addKeyWord')) as any)}
/> />
</div> </div>
) )

View File

@ -106,7 +106,7 @@ const CloudPlanItem: FC<CloudPlanItemProps> = ({
{ICON_MAP[plan]} {ICON_MAP[plan]}
<div className="flex min-h-[104px] flex-col gap-y-2"> <div className="flex min-h-[104px] flex-col gap-y-2">
<div className="flex items-center gap-x-2.5"> <div className="flex items-center gap-x-2.5">
<div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name`)}</div> <div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name` as any) as string}</div>
{ {
isMostPopularPlan && ( isMostPopularPlan && (
<div className="flex items-center justify-center bg-saas-dify-blue-static px-1.5 py-1"> <div className="flex items-center justify-center bg-saas-dify-blue-static px-1.5 py-1">
@ -117,7 +117,7 @@ const CloudPlanItem: FC<CloudPlanItemProps> = ({
) )
} }
</div> </div>
<div className="system-sm-regular text-text-secondary">{t(`${i18nPrefix}.description`)}</div> <div className="system-sm-regular text-text-secondary">{t(`${i18nPrefix}.description` as any) as string}</div>
</div> </div>
</div> </div>
{/* Price */} {/* Price */}

View File

@ -42,7 +42,7 @@ const Button = ({
onClick={handleGetPayUrl} onClick={handleGetPayUrl}
> >
<div className="flex grow items-center gap-x-2"> <div className="flex grow items-center gap-x-2">
<span>{t(`${i18nPrefix}.btnText`)}</span> <span>{t(`${i18nPrefix}.btnText` as any) as string}</span>
{isPremiumPlan && ( {isPremiumPlan && (
<span className="pb-px pt-[7px]"> <span className="pb-px pt-[7px]">
<AwsMarketplace className="h-6" /> <AwsMarketplace className="h-6" />

View File

@ -85,16 +85,16 @@ const SelfHostedPlanItem: FC<SelfHostedPlanItemProps> = ({
<div className=" flex flex-col gap-y-6 px-1 pt-10"> <div className=" flex flex-col gap-y-6 px-1 pt-10">
{STYLE_MAP[plan].icon} {STYLE_MAP[plan].icon}
<div className="flex min-h-[104px] flex-col gap-y-2"> <div className="flex min-h-[104px] flex-col gap-y-2">
<div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name`)}</div> <div className="text-[30px] font-medium leading-[1.2] text-text-primary">{t(`${i18nPrefix}.name` as any) as string}</div>
<div className="system-md-regular line-clamp-2 text-text-secondary">{t(`${i18nPrefix}.description`)}</div> <div className="system-md-regular line-clamp-2 text-text-secondary">{t(`${i18nPrefix}.description` as any) as string}</div>
</div> </div>
</div> </div>
{/* Price */} {/* Price */}
<div className="flex items-end gap-x-2 px-1 pb-8 pt-4"> <div className="flex items-end gap-x-2 px-1 pb-8 pt-4">
<div className="title-4xl-semi-bold shrink-0 text-text-primary">{t(`${i18nPrefix}.price`)}</div> <div className="title-4xl-semi-bold shrink-0 text-text-primary">{t(`${i18nPrefix}.price` as any) as string}</div>
{!isFreePlan && ( {!isFreePlan && (
<span className="system-md-regular pb-0.5 text-text-tertiary"> <span className="system-md-regular pb-0.5 text-text-tertiary">
{t(`${i18nPrefix}.priceTip`)} {t(`${i18nPrefix}.priceTip` as any) as string}
</span> </span>
)} )}
</div> </div>

View File

@ -12,13 +12,13 @@ const List = ({
}: ListProps) => { }: ListProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const i18nPrefix = `billing.plans.${plan}` const i18nPrefix = `billing.plans.${plan}`
const features = t(`${i18nPrefix}.features`, { returnObjects: true }) as string[] const features = t(`${i18nPrefix}.features` as any, { returnObjects: true }) as unknown as string[]
return ( return (
<div className="flex flex-col gap-y-[10px] p-6"> <div className="flex flex-col gap-y-[10px] p-6">
<div className="system-md-semibold text-text-secondary"> <div className="system-md-semibold text-text-secondary">
<Trans <Trans
i18nKey={t(`${i18nPrefix}.includesTitle`)} i18nKey={t(`${i18nPrefix}.includesTitle` as any) as string}
components={{ highlight: <span className="text-text-warning"></span> }} components={{ highlight: <span className="text-text-warning"></span> }}
/> />
</div> </div>

View File

@ -31,7 +31,7 @@ const PriorityLabel = ({ className }: PriorityLabelProps) => {
return ( return (
<Tooltip popupContent={( <Tooltip popupContent={(
<div> <div>
<div className="mb-1 text-xs font-semibold text-text-primary">{`${t('billing.plansCommon.documentProcessingPriority')}: ${t(`billing.plansCommon.priority.${priority}`)}`}</div> <div className="mb-1 text-xs font-semibold text-text-primary">{`${t('billing.plansCommon.documentProcessingPriority')}: ${t(`billing.plansCommon.priority.${priority}` as any) as string}`}</div>
{ {
priority !== DocumentProcessingPriority.topPriority && ( priority !== DocumentProcessingPriority.topPriority && (
<div className="text-xs text-text-secondary">{t('billing.plansCommon.documentProcessingPriorityTip')}</div> <div className="text-xs text-text-secondary">{t('billing.plansCommon.documentProcessingPriorityTip')}</div>
@ -51,7 +51,7 @@ const PriorityLabel = ({ className }: PriorityLabelProps) => {
<RiAedFill className="mr-0.5 size-3" /> <RiAedFill className="mr-0.5 size-3" />
) )
} }
<span>{t(`billing.plansCommon.priority.${priority}`)}</span> <span>{t(`billing.plansCommon.priority.${priority}` as any) as string}</span>
</div> </div>
</Tooltip> </Tooltip>
) )

View File

@ -46,8 +46,8 @@ const UpgradeBtn: FC<Props> = ({
} }
} }
const defaultBadgeLabel = t(`billing.upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}`) const defaultBadgeLabel = t(`billing.upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}` as any) as string
const label = labelKey ? t(labelKey) : defaultBadgeLabel const label = labelKey ? t(labelKey as any) as string : defaultBadgeLabel
if (isPlain) { if (isPlain) {
return ( return (
@ -56,7 +56,7 @@ const UpgradeBtn: FC<Props> = ({
style={style} style={style}
onClick={onClick} onClick={onClick}
> >
{labelKey ? label : t('billing.upgradeBtn.plain')} {labelKey ? label : t('billing.upgradeBtn.plain' as any) as string}
</Button> </Button>
) )
} }

View File

@ -68,7 +68,7 @@ const CustomWebAppBrand = () => {
setFileId(res.id) setFileId(res.id)
}, },
onErrorCallback: (error?: any) => { onErrorCallback: (error?: any) => {
const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t) const errorMessage = getImageUploadErrorMessage(error, t('common.imageUploader.uploadFromComputerUploadError'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
setUploadProgress(-1) setUploadProgress(-1)
}, },

View File

@ -145,7 +145,7 @@ export const useUpload = () => {
handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 }) handleUpdateFile({ ...uploadingFile, uploadedId: res.id, progress: 100 })
}, },
onErrorCallback: (error?: any) => { onErrorCallback: (error?: any) => {
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t) const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
Toast.notify({ type: 'error', message: errorMessage }) Toast.notify({ type: 'error', message: errorMessage })
handleUpdateFile({ ...uploadingFile, progress: -1 }) handleUpdateFile({ ...uploadingFile, progress: -1 })
}, },
@ -187,7 +187,7 @@ export const useUpload = () => {
}) })
}, },
onErrorCallback: (error?: any) => { onErrorCallback: (error?: any) => {
const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t) const errorMessage = getFileUploadErrorMessage(error, t('common.fileUploader.uploadFromComputerUploadError'), t as any)
Toast.notify({ type: 'error', message: errorMessage }) Toast.notify({ type: 'error', message: errorMessage })
handleUpdateFile({ ...uploadingFile, progress: -1 }) handleUpdateFile({ ...uploadingFile, progress: -1 })
}, },

View File

@ -33,8 +33,8 @@ const EconomicalRetrievalMethodConfig: FC<Props> = ({
<div className="space-y-2"> <div className="space-y-2">
<RadioCard <RadioCard
icon={icon} icon={icon}
title={t(`dataset.retrieval.${type}.title`)} title={t(`dataset.retrieval.${type}.title` as any) as string}
description={t(`dataset.retrieval.${type}.description`)} description={t(`dataset.retrieval.${type}.description` as any) as string}
noRadio noRadio
chosenConfigWrapClassName="!pb-3" chosenConfigWrapClassName="!pb-3"
chosenConfig={( chosenConfig={(

View File

@ -44,7 +44,7 @@ const Content = ({
{name} {name}
</div> </div>
<div className="system-2xs-medium-uppercase text-text-tertiary"> <div className="system-2xs-medium-uppercase text-text-tertiary">
{t(`dataset.chunkingMode.${DOC_FORM_TEXT[chunkStructure]}`)} {t(`dataset.chunkingMode.${DOC_FORM_TEXT[chunkStructure]}` as any) as string}
</div> </div>
</div> </div>
</div> </div>

View File

@ -141,7 +141,7 @@ const RuleDetail: FC<{
<FieldInfo <FieldInfo
label={t('datasetSettings.form.retrievalSetting.title')} label={t('datasetSettings.form.retrievalSetting.title')}
// displayedValue={t(`datasetSettings.form.retrievalSetting.${retrievalMethod}`) as string} // displayedValue={t(`datasetSettings.form.retrievalSetting.${retrievalMethod}`) as string}
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title`) as string} displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title` as any) as string}
valueIcon={( valueIcon={(
<Image <Image
className="size-4" className="size-4"

View File

@ -132,7 +132,7 @@ const FileUploader = ({
return Promise.resolve({ ...completeFile }) return Promise.resolve({ ...completeFile })
}) })
.catch((e) => { .catch((e) => {
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t) const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
onFileUpdate(fileItem, -2, fileListRef.current) onFileUpdate(fileItem, -2, fileListRef.current)
return Promise.resolve({ ...fileItem }) return Promise.resolve({ ...fileItem })

View File

@ -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"> <div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
<Stepper <Stepper
steps={Array.from({ length: 3 }, (_, i) => ({ steps={Array.from({ length: 3 }, (_, i) => ({
name: t(STEP_T_MAP[i + 1]), name: t(STEP_T_MAP[i + 1] as any) as string,
}))} }))}
{...rest} {...rest}
/> />

View File

@ -155,7 +155,7 @@ const LocalFile = ({
return Promise.resolve({ ...completeFile }) return Promise.resolve({ ...completeFile })
}) })
.catch((e) => { .catch((e) => {
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t) const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
updateFile(fileItem, -2, fileListRef.current) updateFile(fileItem, -2, fileListRef.current)
return Promise.resolve({ ...fileItem }) return Promise.resolve({ ...fileItem })

View File

@ -63,7 +63,7 @@ const RuleDetail = ({
/> />
<FieldInfo <FieldInfo
label={t('datasetSettings.form.retrievalSetting.title')} label={t('datasetSettings.form.retrievalSetting.title')}
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title`) as string} displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title` as any) as string}
valueIcon={( valueIcon={(
<Image <Image
className="size-4" className="size-4"

View File

@ -75,7 +75,7 @@ const CSVUploader: FC<Props> = ({
return Promise.resolve({ ...completeFile }) return Promise.resolve({ ...completeFile })
}) })
.catch((e) => { .catch((e) => {
const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t) const errorMessage = getFileUploadErrorMessage(e, t('datasetCreation.stepOne.uploader.failed'), t as any)
notify({ type: 'error', message: errorMessage }) notify({ type: 'error', message: errorMessage })
const errorFile = { const errorFile = {
...fileItem, ...fileItem,

View File

@ -133,7 +133,7 @@ const RuleDetail: FC<IRuleDetailProps> = React.memo(({
/> />
<FieldInfo <FieldInfo
label={t('datasetSettings.form.retrievalSetting.title')} label={t('datasetSettings.form.retrievalSetting.title')}
displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title`) as string} displayedValue={t(`dataset.retrieval.${indexingType === IndexingType.ECONOMICAL ? 'keyword_search' : retrievalMethod}.title` as any) as string}
valueIcon={( valueIcon={(
<Image <Image
className="size-4" className="size-4"

View File

@ -228,7 +228,7 @@ const QueryInput = ({
className="flex h-7 cursor-pointer items-center space-x-0.5 rounded-lg border-[0.5px] border-components-button-secondary-bg bg-components-button-secondary-bg px-1.5 shadow-xs backdrop-blur-[5px] hover:bg-components-button-secondary-bg-hover" className="flex h-7 cursor-pointer items-center space-x-0.5 rounded-lg border-[0.5px] border-components-button-secondary-bg bg-components-button-secondary-bg px-1.5 shadow-xs backdrop-blur-[5px] hover:bg-components-button-secondary-bg-hover"
> >
{icon} {icon}
<div className="text-xs font-medium uppercase text-text-secondary">{t(`dataset.retrieval.${retrievalMethod}.title`)}</div> <div className="text-xs font-medium uppercase text-text-secondary">{t(`dataset.retrieval.${retrievalMethod}.title` as any) as string}</div>
<RiEqualizer2Line className="size-4 text-components-menu-item-text"></RiEqualizer2Line> <RiEqualizer2Line className="size-4 text-components-menu-item-text"></RiEqualizer2Line>
</div> </div>
)} )}

View File

@ -217,17 +217,17 @@ const DatasetCard = ({
{dataset.doc_form && ( {dataset.doc_form && (
<span <span
className="min-w-0 max-w-full truncate" className="min-w-0 max-w-full truncate"
title={t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)} title={t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}
> >
{t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`)} {t(`dataset.chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}` as any) as string}
</span> </span>
)} )}
{dataset.indexing_technique && ( {dataset.indexing_technique && (
<span <span
className="min-w-0 max-w-full truncate" className="min-w-0 max-w-full truncate"
title={formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)} title={formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method) as any}
> >
{formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)} {formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method) as any}
</span> </span>
)} )}
{dataset.is_multimodal && ( {dataset.is_multimodal && (

View File

@ -50,7 +50,7 @@ const Category: FC<ICategoryProps> = ({
className={itemClassName(name === value)} className={itemClassName(name === value)}
onClick={() => onChange(name)} onClick={() => onChange(name)}
> >
{(categoryI18n as any)[name] ? t(`explore.category.${name}`) : name} {(categoryI18n as any)[name] ? t(`explore.category.${name}` as any) as string : name}
</div> </div>
))} ))}
</div> </div>

View File

@ -36,13 +36,13 @@ const buildThemeCommands = (query: string, locale?: string): CommandSearchResult
const q = query.toLowerCase() const q = query.toLowerCase()
const list = THEME_ITEMS.filter(item => const list = THEME_ITEMS.filter(item =>
!q !q
|| i18n.t(item.titleKey, { lng: locale }).toLowerCase().includes(q) || i18n.t(item.titleKey as any, { lng: locale }).toLowerCase().includes(q)
|| item.id.includes(q), || item.id.includes(q),
) )
return list.map(item => ({ return list.map(item => ({
id: item.id, id: item.id,
title: i18n.t(item.titleKey, { lng: locale }), title: i18n.t(item.titleKey as any, { lng: locale }),
description: i18n.t(item.descKey, { lng: locale }), description: i18n.t(item.descKey as any, { lng: locale }),
type: 'command' as const, type: 'command' as const,
icon: ( icon: (
<div className="flex h-6 w-6 items-center justify-center rounded-md border-[0.5px] border-divider-regular bg-components-panel-bg"> <div className="flex h-6 w-6 items-center justify-center rounded-md border-[0.5px] border-divider-regular bg-components-panel-bg">

View File

@ -117,7 +117,7 @@ const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, co
'/community': 'app.gotoAnything.actions.communityDesc', '/community': 'app.gotoAnything.actions.communityDesc',
'/zen': 'app.gotoAnything.actions.zenDesc', '/zen': 'app.gotoAnything.actions.zenDesc',
} }
return t(slashKeyMap[item.key] || item.description) return t((slashKeyMap[item.key] || item.description) as any)
})() })()
) )
: ( : (
@ -128,7 +128,7 @@ const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, co
'@knowledge': 'app.gotoAnything.actions.searchKnowledgeBasesDesc', '@knowledge': 'app.gotoAnything.actions.searchKnowledgeBasesDesc',
'@node': 'app.gotoAnything.actions.searchWorkflowNodesDesc', '@node': 'app.gotoAnything.actions.searchWorkflowNodesDesc',
} }
return t(keyMap[item.key]) return t(keyMap[item.key] as any) as string
})() })()
)} )}
</span> </span>

View File

@ -243,7 +243,7 @@ const GotoAnything: FC<Props> = ({
knowledge: 'app.gotoAnything.emptyState.noKnowledgeBasesFound', knowledge: 'app.gotoAnything.emptyState.noKnowledgeBasesFound',
node: 'app.gotoAnything.emptyState.noWorkflowNodesFound', node: 'app.gotoAnything.emptyState.noWorkflowNodesFound',
} }
return t(keyMap[commandType] || 'app.gotoAnything.noResults') return t((keyMap[commandType] || 'app.gotoAnything.noResults') as any)
})() })()
: t('app.gotoAnything.noResults')} : t('app.gotoAnything.noResults')}
</div> </div>
@ -410,7 +410,7 @@ const GotoAnything: FC<Props> = ({
'workflow-node': 'app.gotoAnything.groups.workflowNodes', 'workflow-node': 'app.gotoAnything.groups.workflowNodes',
'command': 'app.gotoAnything.groups.commands', 'command': 'app.gotoAnything.groups.commands',
} }
return t(typeMap[type] || `${type}s`) return t((typeMap[type] || `${type}s`) as any)
})()} })()}
className="p-2 capitalize text-text-secondary" className="p-2 capitalize text-text-secondary"
> >

View File

@ -1,6 +1,7 @@
'use client' 'use client'
import type { Item } from '@/app/components/base/select' import type { Item } from '@/app/components/base/select'
import type { Locale } from '@/i18n-config'
import { useState } from 'react' import { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useContext } from 'use-context-selector' import { useContext } from 'use-context-selector'
@ -32,7 +33,7 @@ export default function LanguagePage() {
await updateUserProfile({ url, body: { [bodyKey]: item.value } }) await updateUserProfile({ url, body: { [bodyKey]: item.value } })
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
setLocaleOnClient(item.value.toString()) setLocaleOnClient(item.value.toString() as Locale)
} }
catch (e) { catch (e) {
notify({ type: 'error', message: (e as Error).message }) notify({ type: 'error', message: (e as Error).message })

View File

@ -36,7 +36,7 @@ const RoleSelector = ({ value, onChange }: RoleSelectorProps) => {
className="block" className="block"
> >
<div className={cn('flex cursor-pointer items-center rounded-lg bg-components-input-bg-normal px-3 py-2 hover:bg-state-base-hover', open && 'bg-state-base-hover')}> <div className={cn('flex cursor-pointer items-center rounded-lg bg-components-input-bg-normal px-3 py-2 hover:bg-state-base-hover', open && 'bg-state-base-hover')}>
<div className="mr-2 grow text-sm leading-5 text-text-primary">{t('common.members.invitedAsRole', { role: t(`common.members.${toHump(value)}`) })}</div> <div className="mr-2 grow text-sm leading-5 text-text-primary">{t('common.members.invitedAsRole', { role: t(`common.members.${toHump(value)}` as any) })}</div>
<RiArrowDownSLine className="h-4 w-4 shrink-0 text-text-secondary" /> <RiArrowDownSLine className="h-4 w-4 shrink-0 text-text-secondary" />
</div> </div>
</PortalToFollowElemTrigger> </PortalToFollowElemTrigger>

View File

@ -106,8 +106,8 @@ const Operation = ({
: <div className="mr-1 mt-[2px] h-4 w-4 text-text-accent" /> : <div className="mr-1 mt-[2px] h-4 w-4 text-text-accent" />
} }
<div> <div>
<div className="system-sm-semibold whitespace-nowrap text-text-secondary">{t(`common.members.${toHump(role)}`)}</div> <div className="system-sm-semibold whitespace-nowrap text-text-secondary">{t(`common.members.${toHump(role)}` as any)}</div>
<div className="system-xs-regular whitespace-nowrap text-text-tertiary">{t(`common.members.${toHump(role)}Tip`)}</div> <div className="system-xs-regular whitespace-nowrap text-text-tertiary">{t(`common.members.${toHump(role)}Tip` as any)}</div>
</div> </div>
</div> </div>
</MenuItem> </MenuItem>

View File

@ -44,7 +44,7 @@ const PresetsParameter: FC<PresetsParameterProps> = ({
text: ( text: (
<div className="flex h-full items-center"> <div className="flex h-full items-center">
{getToneIcon(tone.id)} {getToneIcon(tone.id)}
{t(`common.model.tone.${tone.name}`) as string} {t(`common.model.tone.${tone.name}` as any) as string}
</div> </div>
), ),
} }

View File

@ -82,7 +82,7 @@ const DeprecationNotice: FC<DeprecationNoticeProps> = ({
), ),
}} }}
values={{ values={{
deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}`), deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}` as any) as string,
alternativePluginId, alternativePluginId,
}} }}
/> />
@ -91,7 +91,7 @@ const DeprecationNotice: FC<DeprecationNoticeProps> = ({
{ {
hasValidDeprecatedReason && !alternativePluginId && ( hasValidDeprecatedReason && !alternativePluginId && (
<span> <span>
{t(`${i18nPrefix}.onlyReason`, { deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}`) })} {t(`${i18nPrefix}.onlyReason` as any, { deprecatedReason: t(`${i18nPrefix}.reason.${deprecatedReasonKey}` as any) as string }) as string}
</span> </span>
) )
} }

View File

@ -1,11 +1,14 @@
'use client' 'use client'
import type { Plugin } from '../types' import type { Plugin } from '../types'
import type { Locale } from '@/i18n-config'
import { RiAlertFill } from '@remixicon/react' import { RiAlertFill } from '@remixicon/react'
import * as React from 'react' import * as React from 'react'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks' import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
import { useGetLanguage } from '@/context/i18n' import { useGetLanguage } from '@/context/i18n'
import useTheme from '@/hooks/use-theme' import useTheme from '@/hooks/use-theme'
import { renderI18nObject } from '@/i18n-config' import {
renderI18nObject,
} from '@/i18n-config'
import { getLanguage } from '@/i18n-config/language' import { getLanguage } from '@/i18n-config/language'
import { Theme } from '@/types/app' import { Theme } from '@/types/app'
import { cn } from '@/utils/classnames' import { cn } from '@/utils/classnames'
@ -30,7 +33,7 @@ export type Props = {
footer?: React.ReactNode footer?: React.ReactNode
isLoading?: boolean isLoading?: boolean
loadingFileName?: string loadingFileName?: string
locale?: string locale?: Locale
limitedInstall?: boolean limitedInstall?: boolean
} }

View File

@ -20,7 +20,7 @@ export const useTags = (translateFromOut?: TFunction) => {
return tagKeys.map((tag) => { return tagKeys.map((tag) => {
return { return {
name: tag, name: tag,
label: t(`pluginTags.tags.${tag}`), label: t(`pluginTags.tags.${tag}` as any) as string,
} }
}) })
}, [t]) }, [t])
@ -66,14 +66,14 @@ export const useCategories = (translateFromOut?: TFunction, isSingle?: boolean)
} }
return { return {
name: category, name: category,
label: isSingle ? t(`plugin.categorySingle.${category}`) : t(`plugin.category.${category}s`), label: isSingle ? t(`plugin.categorySingle.${category}` as any) as string : t(`plugin.category.${category}s` as any) as string,
} }
}) })
}, [t, isSingle]) }, [t, isSingle])
const categoriesMap = useMemo(() => { const categoriesMap = useMemo(() => {
return categories.reduce((acc, category) => { return categories.reduce((acc, category) => {
acc[category.name] = category acc[category.name] = category as any
return acc return acc
}, {} as Record<string, Category>) }, {} as Record<string, Category>)
}, [categories]) }, [categories])

View File

@ -1,10 +1,11 @@
import type { Locale } from '@/i18n-config'
import { import {
getLocaleOnServer, getLocaleOnServer,
useTranslation as translate, getTranslation as translate,
} from '@/i18n-config/server' } from '@/i18n-config/server'
type DescriptionProps = { type DescriptionProps = {
locale?: string locale?: Locale
} }
const Description = async ({ const Description = async ({
locale: localeFromProps, locale: localeFromProps,

View File

@ -1,5 +1,6 @@
import type { MarketplaceCollection, SearchParams } from './types' import type { MarketplaceCollection, SearchParams } from './types'
import type { Plugin } from '@/app/components/plugins/types' import type { Plugin } from '@/app/components/plugins/types'
import type { Locale } from '@/i18n-config'
import { TanstackQueryInitializer } from '@/context/query-client' import { TanstackQueryInitializer } from '@/context/query-client'
import { MarketplaceContextProvider } from './context' import { MarketplaceContextProvider } from './context'
import Description from './description' import Description from './description'
@ -8,7 +9,7 @@ import StickySearchAndSwitchWrapper from './sticky-search-and-switch-wrapper'
import { getMarketplaceCollectionsAndPlugins } from './utils' import { getMarketplaceCollectionsAndPlugins } from './utils'
type MarketplaceProps = { type MarketplaceProps = {
locale: string locale: Locale
showInstallButton?: boolean showInstallButton?: boolean
shouldExclude?: boolean shouldExclude?: boolean
searchParams?: SearchParams searchParams?: SearchParams

View File

@ -1,5 +1,6 @@
'use client' 'use client'
import type { Plugin } from '@/app/components/plugins/types' import type { Plugin } from '@/app/components/plugins/types'
import type { Locale } from '@/i18n-config'
import { RiArrowRightUpLine } from '@remixicon/react' import { RiArrowRightUpLine } from '@remixicon/react'
import { useBoolean } from 'ahooks' import { useBoolean } from 'ahooks'
import { useTheme } from 'next-themes' import { useTheme } from 'next-themes'
@ -17,7 +18,7 @@ import { getPluginDetailLinkInMarketplace, getPluginLinkInMarketplace } from '..
type CardWrapperProps = { type CardWrapperProps = {
plugin: Plugin plugin: Plugin
showInstallButton?: boolean showInstallButton?: boolean
locale?: string locale?: Locale
} }
const CardWrapperComponent = ({ const CardWrapperComponent = ({
plugin, plugin,

View File

@ -1,6 +1,7 @@
'use client' 'use client'
import type { Plugin } from '../../types' import type { Plugin } from '../../types'
import type { MarketplaceCollection } from '../types' import type { MarketplaceCollection } from '../types'
import type { Locale } from '@/i18n-config'
import { cn } from '@/utils/classnames' import { cn } from '@/utils/classnames'
import Empty from '../empty' import Empty from '../empty'
import CardWrapper from './card-wrapper' import CardWrapper from './card-wrapper'
@ -11,7 +12,7 @@ type ListProps = {
marketplaceCollectionPluginsMap: Record<string, Plugin[]> marketplaceCollectionPluginsMap: Record<string, Plugin[]>
plugins?: Plugin[] plugins?: Plugin[]
showInstallButton?: boolean showInstallButton?: boolean
locale: string locale: Locale
cardContainerClassName?: string cardContainerClassName?: string
cardRender?: (plugin: Plugin) => React.JSX.Element | null cardRender?: (plugin: Plugin) => React.JSX.Element | null
onMoreClick?: () => void onMoreClick?: () => void

View File

@ -3,6 +3,7 @@
import type { MarketplaceCollection } from '../types' import type { MarketplaceCollection } from '../types'
import type { SearchParamsFromCollection } from '@/app/components/plugins/marketplace/types' import type { SearchParamsFromCollection } from '@/app/components/plugins/marketplace/types'
import type { Plugin } from '@/app/components/plugins/types' import type { Plugin } from '@/app/components/plugins/types'
import type { Locale } from '@/i18n-config'
import { RiArrowRightSLine } from '@remixicon/react' import { RiArrowRightSLine } from '@remixicon/react'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks' import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
import { getLanguage } from '@/i18n-config/language' import { getLanguage } from '@/i18n-config/language'
@ -13,7 +14,7 @@ type ListWithCollectionProps = {
marketplaceCollections: MarketplaceCollection[] marketplaceCollections: MarketplaceCollection[]
marketplaceCollectionPluginsMap: Record<string, Plugin[]> marketplaceCollectionPluginsMap: Record<string, Plugin[]>
showInstallButton?: boolean showInstallButton?: boolean
locale: string locale: Locale
cardContainerClassName?: string cardContainerClassName?: string
cardRender?: (plugin: Plugin) => React.JSX.Element | null cardRender?: (plugin: Plugin) => React.JSX.Element | null
onMoreClick?: (searchParams?: SearchParamsFromCollection) => void onMoreClick?: (searchParams?: SearchParamsFromCollection) => void

View File

@ -1,6 +1,7 @@
'use client' 'use client'
import type { Plugin } from '../../types' import type { Plugin } from '../../types'
import type { MarketplaceCollection } from '../types' import type { MarketplaceCollection } from '../types'
import type { Locale } from '@/i18n-config'
import { useEffect } from 'react' import { useEffect } from 'react'
import Loading from '@/app/components/base/loading' import Loading from '@/app/components/base/loading'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks' import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
@ -12,7 +13,7 @@ type ListWrapperProps = {
marketplaceCollections: MarketplaceCollection[] marketplaceCollections: MarketplaceCollection[]
marketplaceCollectionPluginsMap: Record<string, Plugin[]> marketplaceCollectionPluginsMap: Record<string, Plugin[]>
showInstallButton?: boolean showInstallButton?: boolean
locale: string locale: Locale
} }
const ListWrapper = ({ const ListWrapper = ({
marketplaceCollections, marketplaceCollections,

View File

@ -330,7 +330,7 @@ export const CommonCreateModal = ({ onClose, createType, builder }: Props) => {
return ( return (
<Modal <Modal
title={t(`pluginTrigger.modal.${createType === SupportedCreationMethods.APIKEY ? 'apiKey' : createType.toLowerCase()}.title`)} title={t(`pluginTrigger.modal.${createType === SupportedCreationMethods.APIKEY ? 'apiKey' : createType.toLowerCase()}.title` as any)}
confirmButtonText={ confirmButtonText={
currentStep === ApiKeyStep.Verify currentStep === ApiKeyStep.Verify
? isVerifyingCredentials ? t('pluginTrigger.modal.common.verifying') : t('pluginTrigger.modal.common.verify') ? isVerifyingCredentials ? t('pluginTrigger.modal.common.verifying') : t('pluginTrigger.modal.common.verify')

View File

@ -208,7 +208,7 @@ export const CreateSubscriptionButton = ({ buttonType = CreateButtonType.FULL_BU
) )
: ( : (
<Tooltip <Tooltip
popupContent={subscriptionCount >= MAX_COUNT ? t('pluginTrigger.subscription.maxCount', { num: MAX_COUNT }) : t(`pluginTrigger.subscription.addType.options.${methodType.toLowerCase()}.description`)} popupContent={subscriptionCount >= MAX_COUNT ? t('pluginTrigger.subscription.maxCount', { num: MAX_COUNT }) : t(`pluginTrigger.subscription.addType.options.${methodType.toLowerCase()}.description` as any)}
disabled={!(supportedMethods?.length === 1 || subscriptionCount >= MAX_COUNT)} disabled={!(supportedMethods?.length === 1 || subscriptionCount >= MAX_COUNT)}
> >
<ActionButton <ActionButton

View File

@ -260,9 +260,9 @@ export type Plugin = {
icon: string icon: string
icon_dark?: string icon_dark?: string
verified: boolean verified: boolean
label: Record<Locale, string> label: Partial<Record<Locale, string>>
brief: Record<Locale, string> brief: Partial<Record<Locale, string>>
description: Record<Locale, string> description: Partial<Record<Locale, string>>
// Repo readme.md content // Repo readme.md content
introduction: string introduction: string
repository: string repository: string

View File

@ -36,8 +36,8 @@ export const useAvailableNodesMetaData = () => {
const availableNodesMetaData = useMemo(() => mergedNodesMetaData.map((node) => { const availableNodesMetaData = useMemo(() => mergedNodesMetaData.map((node) => {
const { metaData } = node const { metaData } = node
const title = t(`workflow.blocks.${metaData.type}`) const title = t(`workflow.blocks.${metaData.type}` as any) as string
const description = t(`workflow.blocksAbout.${metaData.type}`) const description = t(`workflow.blocksAbout.${metaData.type}` as any) as string
return { return {
...node, ...node,
metaData: { metaData: {

View File

@ -14,7 +14,7 @@ export const usePipelineTemplate = () => {
data: { data: {
...knowledgeBaseDefault.defaultValue as KnowledgeBaseNodeType, ...knowledgeBaseDefault.defaultValue as KnowledgeBaseNodeType,
type: knowledgeBaseDefault.metaData.type, type: knowledgeBaseDefault.metaData.type,
title: t(`workflow.blocks.${knowledgeBaseDefault.metaData.type}`), title: t(`workflow.blocks.${knowledgeBaseDefault.metaData.type}` as any) as string,
selected: true, selected: true,
}, },
position: { position: {

View File

@ -111,7 +111,7 @@ const GetSchema: FC<Props> = ({
}} }}
className="system-sm-regular cursor-pointer whitespace-nowrap rounded-lg px-3 py-1.5 leading-5 text-text-secondary hover:bg-components-panel-on-panel-item-bg-hover" className="system-sm-regular cursor-pointer whitespace-nowrap rounded-lg px-3 py-1.5 leading-5 text-text-secondary hover:bg-components-panel-on-panel-item-bg-hover"
> >
{t(`tools.createTool.exampleOptions.${item.key}`)} {t(`tools.createTool.exampleOptions.${item.key}` as any) as string}
</div> </div>
))} ))}
</div> </div>

View File

@ -292,7 +292,7 @@ const EditCustomCollectionModal: FC<Props> = ({
<div> <div>
<div className="system-sm-medium py-2 text-text-primary">{t('tools.createTool.authMethod.title')}</div> <div className="system-sm-medium py-2 text-text-primary">{t('tools.createTool.authMethod.title')}</div>
<div className="flex h-9 cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2.5" onClick={() => setCredentialsModalShow(true)}> <div className="flex h-9 cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2.5" onClick={() => setCredentialsModalShow(true)}>
<div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${credential.auth_type}`)}</div> <div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${credential.auth_type}` as any) as string}</div>
<RiSettings2Line className="h-4 w-4 text-text-secondary" /> <RiSettings2Line className="h-4 w-4 text-text-secondary" />
</div> </div>
</div> </div>

View File

@ -78,7 +78,7 @@ const TestApi: FC<Props> = ({
<div> <div>
<div className="system-sm-medium py-2 text-text-primary">{t('tools.createTool.authMethod.title')}</div> <div className="system-sm-medium py-2 text-text-primary">{t('tools.createTool.authMethod.title')}</div>
<div className="flex h-9 cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2.5" onClick={() => setCredentialsModalShow(true)}> <div className="flex h-9 cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal px-2.5" onClick={() => setCredentialsModalShow(true)}>
<div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${tempCredential.auth_type}`)}</div> <div className="system-xs-regular text-text-primary">{t(`tools.createTool.authMethod.types.${tempCredential.auth_type}` as any) as string}</div>
<RiSettings2Line className="h-4 w-4 text-text-secondary" /> <RiSettings2Line className="h-4 w-4 text-text-secondary" />
</div> </div>
</div> </div>

View File

@ -33,17 +33,17 @@ const Empty = ({
const Comp = (hasLink ? Link : 'div') as any const Comp = (hasLink ? Link : 'div') as any
const linkProps = hasLink ? { href: getLink(type), target: '_blank' } : {} const linkProps = hasLink ? { href: getLink(type), target: '_blank' } : {}
const renderType = isAgent ? 'agent' : type const renderType = isAgent ? 'agent' : type
const hasTitle = t(`tools.addToolModal.${renderType}.title`) !== `tools.addToolModal.${renderType}.title` const hasTitle = t(`tools.addToolModal.${renderType}.title` as any) as string !== `tools.addToolModal.${renderType}.title`
return ( return (
<div className="flex flex-col items-center justify-center"> <div className="flex flex-col items-center justify-center">
<NoToolPlaceholder className={theme === 'dark' ? 'invert' : ''} /> <NoToolPlaceholder className={theme === 'dark' ? 'invert' : ''} />
<div className="mb-1 mt-2 text-[13px] font-medium leading-[18px] text-text-primary"> <div className="mb-1 mt-2 text-[13px] font-medium leading-[18px] text-text-primary">
{hasTitle ? t(`tools.addToolModal.${renderType}.title`) : 'No tools available'} {hasTitle ? t(`tools.addToolModal.${renderType}.title` as any) as string : 'No tools available'}
</div> </div>
{(!isAgent && hasTitle) && ( {(!isAgent && hasTitle) && (
<Comp className={cn('flex items-center text-[13px] leading-[18px] text-text-tertiary', hasLink && 'cursor-pointer hover:text-text-accent')} {...linkProps}> <Comp className={cn('flex items-center text-[13px] leading-[18px] text-text-tertiary', hasLink && 'cursor-pointer hover:text-text-accent')} {...linkProps}>
{t(`tools.addToolModal.${renderType}.tip`)} {t(`tools.addToolModal.${renderType}.tip` as any) as string}
{' '} {' '}
{hasLink && <RiArrowRightUpLine className="ml-0.5 h-3 w-3" />} {hasLink && <RiArrowRightUpLine className="ml-0.5 h-3 w-3" />}
</Comp> </Comp>

View File

@ -42,8 +42,8 @@ export const useAvailableNodesMetaData = () => {
const availableNodesMetaData = useMemo(() => mergedNodesMetaData.map((node) => { const availableNodesMetaData = useMemo(() => mergedNodesMetaData.map((node) => {
const { metaData } = node const { metaData } = node
const title = t(`workflow.blocks.${metaData.type}`) const title = t(`workflow.blocks.${metaData.type}` as any) as string
const description = t(`workflow.blocksAbout.${metaData.type}`) const description = t(`workflow.blocksAbout.${metaData.type}` as any) as string
const helpLinkPath = `guides/workflow/node/${metaData.helpLinkUri}` const helpLinkPath = `guides/workflow/node/${metaData.helpLinkUri}`
return { return {
...node, ...node,

View File

@ -18,7 +18,7 @@ export const useWorkflowTemplate = () => {
data: { data: {
...startDefault.defaultValue as StartNodeType, ...startDefault.defaultValue as StartNodeType,
type: startDefault.metaData.type, type: startDefault.metaData.type,
title: t(`workflow.blocks.${startDefault.metaData.type}`), title: t(`workflow.blocks.${startDefault.metaData.type}` as any) as string,
}, },
position: START_INITIAL_POSITION, position: START_INITIAL_POSITION,
}) })
@ -34,7 +34,7 @@ export const useWorkflowTemplate = () => {
}, },
selected: true, selected: true,
type: llmDefault.metaData.type, type: llmDefault.metaData.type,
title: t(`workflow.blocks.${llmDefault.metaData.type}`), title: t(`workflow.blocks.${llmDefault.metaData.type}` as any) as string,
}, },
position: { position: {
x: START_INITIAL_POSITION.x + NODE_WIDTH_X_OFFSET, x: START_INITIAL_POSITION.x + NODE_WIDTH_X_OFFSET,
@ -48,7 +48,7 @@ export const useWorkflowTemplate = () => {
...answerDefault.defaultValue, ...answerDefault.defaultValue,
answer: `{{#${llmNode.id}.text#}}`, answer: `{{#${llmNode.id}.text#}}`,
type: answerDefault.metaData.type, type: answerDefault.metaData.type,
title: t(`workflow.blocks.${answerDefault.metaData.type}`), title: t(`workflow.blocks.${answerDefault.metaData.type}` as any) as string,
}, },
position: { position: {
x: START_INITIAL_POSITION.x + NODE_WIDTH_X_OFFSET * 2, x: START_INITIAL_POSITION.x + NODE_WIDTH_X_OFFSET * 2,

View File

@ -85,7 +85,7 @@ const Blocks = ({
{ {
classification !== '-' && !!filteredList.length && ( classification !== '-' && !!filteredList.length && (
<div className="flex h-[22px] items-start px-3 text-xs font-medium text-text-tertiary"> <div className="flex h-[22px] items-start px-3 text-xs font-medium text-text-tertiary">
{t(`workflow.tabs.${classification}`)} {t(`workflow.tabs.${classification}` as any) as string}
</div> </div>
) )
} }

View File

@ -2,6 +2,7 @@
import type { ToolWithProvider } from '../types' import type { ToolWithProvider } from '../types'
import type { ToolDefaultValue, ToolValue } from './types' import type { ToolDefaultValue, ToolValue } from './types'
import type { Plugin } from '@/app/components/plugins/types' import type { Plugin } from '@/app/components/plugins/types'
import type { Locale } from '@/i18n-config'
import { RiMoreLine } from '@remixicon/react' import { RiMoreLine } from '@remixicon/react'
import Link from 'next/link' import Link from 'next/link'
import { useEffect, useMemo, useState } from 'react' import { useEffect, useMemo, useState } from 'react'
@ -178,7 +179,7 @@ const FeaturedTools = ({
onInstallSuccess={async () => { onInstallSuccess={async () => {
await onInstallSuccess?.() await onInstallSuccess?.()
}} }}
t={t} t={t as any}
/> />
))} ))}
</div> </div>
@ -221,7 +222,7 @@ const FeaturedTools = ({
type FeaturedToolUninstalledItemProps = { type FeaturedToolUninstalledItemProps = {
plugin: Plugin plugin: Plugin
language: string language: Locale
onInstallSuccess?: () => Promise<void> | void onInstallSuccess?: () => Promise<void> | void
t: (key: string, options?: Record<string, any>) => string t: (key: string, options?: Record<string, any>) => string
} }

View File

@ -1,6 +1,7 @@
'use client' 'use client'
import type { TriggerDefaultValue, TriggerWithProvider } from './types' import type { TriggerDefaultValue, TriggerWithProvider } from './types'
import type { Plugin } from '@/app/components/plugins/types' import type { Plugin } from '@/app/components/plugins/types'
import type { Locale } from '@/i18n-config'
import { RiMoreLine } from '@remixicon/react' import { RiMoreLine } from '@remixicon/react'
import Link from 'next/link' import Link from 'next/link'
import { useEffect, useMemo, useState } from 'react' import { useEffect, useMemo, useState } from 'react'
@ -170,7 +171,7 @@ const FeaturedTriggers = ({
onInstallSuccess={async () => { onInstallSuccess={async () => {
await onInstallSuccess?.() await onInstallSuccess?.()
}} }}
t={t} t={t as any}
/> />
))} ))}
</div> </div>
@ -213,7 +214,7 @@ const FeaturedTriggers = ({
type FeaturedTriggerUninstalledItemProps = { type FeaturedTriggerUninstalledItemProps = {
plugin: Plugin plugin: Plugin
language: string language: Locale
onInstallSuccess?: () => Promise<void> | void onInstallSuccess?: () => Promise<void> | void
t: (key: string, options?: Record<string, any>) => string t: (key: string, options?: Record<string, any>) => string
} }

View File

@ -17,7 +17,7 @@ export const useBlocks = () => {
return BLOCKS.map((block) => { return BLOCKS.map((block) => {
return { return {
...block, ...block,
title: t(`workflow.blocks.${block.type}`), title: t(`workflow.blocks.${block.type}` as any) as string,
} }
}) })
} }
@ -28,7 +28,7 @@ export const useStartBlocks = () => {
return START_BLOCKS.map((block) => { return START_BLOCKS.map((block) => {
return { return {
...block, ...block,
title: t(`workflow.blocks.${block.type}`), title: t(`workflow.blocks.${block.type}` as any) as string,
} }
}) })
} }

View File

@ -43,7 +43,7 @@ const StartBlocks = ({
if (blockType === BlockEnumValues.TriggerWebhook) if (blockType === BlockEnumValues.TriggerWebhook)
return t('workflow.customWebhook') return t('workflow.customWebhook')
return t(`workflow.blocks.${blockType}`) return t(`workflow.blocks.${blockType}` as any) as string
} }
return START_BLOCKS.filter((block) => { return START_BLOCKS.filter((block) => {
@ -83,10 +83,10 @@ const StartBlocks = ({
<div className="system-md-medium mb-1 text-text-primary"> <div className="system-md-medium mb-1 text-text-primary">
{block.type === BlockEnumValues.TriggerWebhook {block.type === BlockEnumValues.TriggerWebhook
? t('workflow.customWebhook') ? t('workflow.customWebhook')
: t(`workflow.blocks.${block.type}`)} : t(`workflow.blocks.${block.type}` as any) as string}
</div> </div>
<div className="system-xs-regular text-text-secondary"> <div className="system-xs-regular text-text-secondary">
{t(`workflow.blocksAbout.${block.type}`)} {t(`workflow.blocksAbout.${block.type}` as any) as string}
</div> </div>
{(block.type === BlockEnumValues.TriggerWebhook || block.type === BlockEnumValues.TriggerSchedule) && ( {(block.type === BlockEnumValues.TriggerWebhook || block.type === BlockEnumValues.TriggerSchedule) && (
<div className="system-xs-regular mb-1 mt-1 text-text-tertiary"> <div className="system-xs-regular mb-1 mt-1 text-text-tertiary">
@ -107,7 +107,7 @@ const StartBlocks = ({
type={block.type} type={block.type}
/> />
<div className="flex w-0 grow items-center justify-between text-sm text-text-secondary"> <div className="flex w-0 grow items-center justify-between text-sm text-text-secondary">
<span className="truncate">{t(`workflow.blocks.${block.type}`)}</span> <span className="truncate">{t(`workflow.blocks.${block.type}` as any) as string}</span>
{block.type === BlockEnumValues.Start && ( {block.type === BlockEnumValues.Start && (
<span className="system-xs-regular ml-2 shrink-0 text-text-quaternary">{t('workflow.blocks.originalStartNode')}</span> <span className="system-xs-regular ml-2 shrink-0 text-text-quaternary">{t('workflow.blocks.originalStartNode')}</span>
)} )}

View File

@ -237,8 +237,8 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {
list.push({ list.push({
id: `${type}-need-added`, id: `${type}-need-added`,
type, type,
title: t(`workflow.blocks.${type}`), title: t(`workflow.blocks.${type}` as any) as string,
errorMessage: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}`) }), errorMessage: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}` as any) as string }),
canNavigate: false, canNavigate: false,
}) })
} }
@ -409,7 +409,7 @@ export const useChecklistBeforePublish = () => {
const type = isRequiredNodesType[i] const type = isRequiredNodesType[i]
if (!filteredNodes.find(node => node.data.type === type)) { if (!filteredNodes.find(node => node.data.type === type)) {
notify({ type: 'error', message: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}`) }) }) notify({ type: 'error', message: t('workflow.common.needAdd', { node: t(`workflow.blocks.${type}` as any) as string }) })
return false return false
} }
} }

View File

@ -44,7 +44,7 @@ const OutputVarList: FC<Props> = ({
if (!isValid) { if (!isValid) {
setToastHandler(Toast.notify({ setToastHandler(Toast.notify({
type: 'error', type: 'error',
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }), message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }),
})) }))
return return
} }

View File

@ -57,7 +57,7 @@ const VarList: FC<Props> = ({
if (!isValid) { if (!isValid) {
setToastHandle(Toast.notify({ setToastHandle(Toast.notify({
type: 'error', type: 'error',
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }), message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }),
})) }))
return return
} }

View File

@ -72,7 +72,7 @@ const OperationSelector: FC<OperationSelectorProps> = ({
className={`system-sm-regular overflow-hidden truncate text-ellipsis className={`system-sm-regular overflow-hidden truncate text-ellipsis
${selectedItem ? 'text-components-input-text-filled' : 'text-components-input-text-disabled'}`} ${selectedItem ? 'text-components-input-text-filled' : 'text-components-input-text-disabled'}`}
> >
{selectedItem?.name ? t(`${i18nPrefix}.operations.${selectedItem?.name}`) : t(`${i18nPrefix}.operations.title`)} {selectedItem?.name ? t(`${i18nPrefix}.operations.${selectedItem?.name}` as any) as string : t(`${i18nPrefix}.operations.title` as any) as string}
</span> </span>
</div> </div>
<RiArrowDownSLine className={`h-4 w-4 text-text-quaternary ${disabled && 'text-components-input-text-placeholder'} ${open && 'text-text-secondary'}`} /> <RiArrowDownSLine className={`h-4 w-4 text-text-quaternary ${disabled && 'text-components-input-text-placeholder'} ${open && 'text-text-secondary'}`} />
@ -83,7 +83,7 @@ const OperationSelector: FC<OperationSelectorProps> = ({
<div className="flex w-[140px] flex-col items-start rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg"> <div className="flex w-[140px] flex-col items-start rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg">
<div className="flex flex-col items-start self-stretch p-1"> <div className="flex flex-col items-start self-stretch p-1">
<div className="flex items-start self-stretch px-3 pb-0.5 pt-1"> <div className="flex items-start self-stretch px-3 pb-0.5 pt-1">
<div className="system-xs-medium-uppercase flex grow text-text-tertiary">{t(`${i18nPrefix}.operations.title`)}</div> <div className="system-xs-medium-uppercase flex grow text-text-tertiary">{t(`${i18nPrefix}.operations.title` as any) as string}</div>
</div> </div>
{items.map(item => ( {items.map(item => (
item.value === 'divider' item.value === 'divider'
@ -100,7 +100,7 @@ const OperationSelector: FC<OperationSelectorProps> = ({
}} }}
> >
<div className="flex min-h-5 grow items-center gap-1 px-1"> <div className="flex min-h-5 grow items-center gap-1 px-1">
<span className="system-sm-medium flex grow text-text-secondary">{t(`${i18nPrefix}.operations.${item.name}`)}</span> <span className="system-sm-medium flex grow text-text-secondary">{t(`${i18nPrefix}.operations.${item.name}` as any) as string}</span>
</div> </div>
{item.value === value && ( {item.value === value && (
<div className="flex items-center justify-center"> <div className="flex items-center justify-center">

View File

@ -73,7 +73,7 @@ const NodeComponent: FC<NodeProps<AssignerNodeType>> = ({
nodeType={node?.data.type} nodeType={node?.data.type}
nodeTitle={node?.data.title} nodeTitle={node?.data.title}
rightSlot={ rightSlot={
writeMode && <Badge className="!ml-auto shrink-0" text={t(`${i18nPrefix}.operations.${writeMode}`)} /> writeMode && <Badge className="!ml-auto shrink-0" text={t(`${i18nPrefix}.operations.${writeMode}` as any) as string} />
} }
/> />
</div> </div>

View File

@ -34,7 +34,7 @@ const ConditionValue = ({
const variableSelector = variable_selector as ValueSelector const variableSelector = variable_selector as ValueSelector
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
const formatValue = useCallback((c: Condition) => { const formatValue = useCallback((c: Condition) => {
const notHasValue = comparisonOperatorNotRequireValue(c.comparison_operator) const notHasValue = comparisonOperatorNotRequireValue(c.comparison_operator)
if (notHasValue) if (notHasValue)
@ -59,7 +59,7 @@ const ConditionValue = ({
if (isSelect) { if (isSelect) {
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(c.value) ? c.value[0] : c.value))[0] const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(c.value) ? c.value[0] : c.value))[0]
return name return name
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => { ? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
const arr: string[] = b.split('.') const arr: string[] = b.split('.')
if (isSystemVar(arr)) if (isSystemVar(arr))
return `{{${b}}}` return `{{${b}}}`
@ -91,9 +91,9 @@ const ConditionValue = ({
sub_variable_condition?.conditions.map((c: Condition, index) => ( sub_variable_condition?.conditions.map((c: Condition, index) => (
<div className="relative flex h-6 items-center space-x-1" key={c.id}> <div className="relative flex h-6 items-center space-x-1" key={c.id}>
<div className="system-xs-medium text-text-accent">{c.key}</div> <div className="system-xs-medium text-text-accent">{c.key}</div>
<div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}`) : c.comparison_operator}</div> <div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}` as any) as string : c.comparison_operator}</div>
{c.comparison_operator && !isEmptyRelatedOperator(c.comparison_operator) && <div className="system-xs-regular text-text-secondary">{isSelect(c) ? selectName(c) : formatValue(c)}</div>} {c.comparison_operator && !isEmptyRelatedOperator(c.comparison_operator) && <div className="system-xs-regular text-text-secondary">{isSelect(c) ? selectName(c) : formatValue(c)}</div>}
{index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}`)}</div>)} {index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}` as any) as string}</div>)}
</div> </div>
)) ))
} }

View File

@ -168,13 +168,13 @@ const ConditionItem = ({
if (isSelect) { if (isSelect) {
if (fileAttr?.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) { if (fileAttr?.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) {
return FILE_TYPE_OPTIONS.map(item => ({ return FILE_TYPE_OPTIONS.map(item => ({
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`), name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
value: item.value, value: item.value,
})) }))
} }
if (fileAttr?.key === 'transfer_method') { if (fileAttr?.key === 'transfer_method') {
return TRANSFER_METHOD.map(item => ({ return TRANSFER_METHOD.map(item => ({
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`), name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
value: item.value, value: item.value,
})) }))
} }

View File

@ -39,7 +39,7 @@ const ConditionOperator = ({
const options = useMemo(() => { const options = useMemo(() => {
return getOperators(varType, file).map((o) => { return getOperators(varType, file).map((o) => {
return { return {
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}`) : o, label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}` as any) as string : o,
value: o, value: o,
} }
}) })
@ -65,7 +65,7 @@ const ConditionOperator = ({
{ {
selectedOption selectedOption
? selectedOption.label ? selectedOption.label
: t(`${i18nPrefix}.select`) : t(`${i18nPrefix}.select` as any) as string
} }
<RiArrowDownSLine className="ml-1 h-3.5 w-3.5" /> <RiArrowDownSLine className="ml-1 h-3.5 w-3.5" />
</Button> </Button>

View File

@ -35,7 +35,7 @@ const ConditionValue = ({
const { t } = useTranslation() const { t } = useTranslation()
const nodes = useNodes() const nodes = useNodes()
const variableName = labelName || (isSystemVar(variableSelector) ? variableSelector.slice(0).join('.') : variableSelector.slice(1).join('.')) const variableName = labelName || (isSystemVar(variableSelector) ? variableSelector.slice(0).join('.') : variableSelector.slice(1).join('.'))
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
const notHasValue = comparisonOperatorNotRequireValue(operator) const notHasValue = comparisonOperatorNotRequireValue(operator)
const node: Node<CommonNodeType> | undefined = nodes.find(n => n.id === variableSelector[0]) as Node<CommonNodeType> const node: Node<CommonNodeType> | undefined = nodes.find(n => n.id === variableSelector[0]) as Node<CommonNodeType>
const isException = isExceptionVariable(variableName, node?.data.type) const isException = isExceptionVariable(variableName, node?.data.type)
@ -63,7 +63,7 @@ const ConditionValue = ({
if (isSelect) { if (isSelect) {
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(value) ? value[0] : value))[0] const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(value) ? value[0] : value))[0]
return name return name
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => { ? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
const arr: string[] = b.split('.') const arr: string[] = b.split('.')
if (isSystemVar(arr)) if (isSystemVar(arr))
return `{{${b}}}` return `{{${b}}}`

View File

@ -135,7 +135,7 @@ export const useNodeIterationInteractions = () => {
_isBundled: false, _isBundled: false,
_connectedSourceHandleIds: [], _connectedSourceHandleIds: [],
_connectedTargetHandleIds: [], _connectedTargetHandleIds: [],
title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${childNodeType}`)} ${childNodeTypeCount[childNodeType]}` : t(`workflow.blocks.${childNodeType}`), title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${childNodeType}` as any) as string} ${childNodeTypeCount[childNodeType]}` : t(`workflow.blocks.${childNodeType}` as any) as string,
iteration_id: newNodeId, iteration_id: newNodeId,
type: childNodeType, type: childNodeType,
}, },

View File

@ -121,7 +121,7 @@ const DatasetItem: FC<Props> = ({
payload.provider === 'external' && ( payload.provider === 'external' && (
<Badge <Badge
className="shrink-0 group-hover/dataset-item:hidden" className="shrink-0 group-hover/dataset-item:hidden"
text={t('dataset.externalTag') as string} text={t('dataset.externalTag')}
/> />
) )
} }

View File

@ -42,7 +42,7 @@ const ConditionOperator = ({
const options = useMemo(() => { const options = useMemo(() => {
return getOperators(variableType).map((o) => { return getOperators(variableType).map((o) => {
return { return {
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}`) : o, label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}` as any) as string : o,
value: o, value: o,
} }
}) })
@ -68,7 +68,7 @@ const ConditionOperator = ({
{ {
selectedOption selectedOption
? selectedOption.label ? selectedOption.label
: t(`${i18nPrefix}.select`) : t(`${i18nPrefix}.select` as any) as string
} }
<RiArrowDownSLine className="ml-1 h-3.5 w-3.5" /> <RiArrowDownSLine className="ml-1 h-3.5 w-3.5" />
</Button> </Button>

View File

@ -66,13 +66,13 @@ const FilterCondition: FC<Props> = ({
if (isSelect) { if (isSelect) {
if (condition.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) { if (condition.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) {
return FILE_TYPE_OPTIONS.map(item => ({ return FILE_TYPE_OPTIONS.map(item => ({
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`), name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
value: item.value, value: item.value,
})) }))
} }
if (condition.key === 'transfer_method') { if (condition.key === 'transfer_method') {
return TRANSFER_METHOD.map(item => ({ return TRANSFER_METHOD.map(item => ({
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`), name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
value: item.value, value: item.value,
})) }))
} }

View File

@ -121,7 +121,7 @@ const ConfigPromptItem: FC<Props> = ({
<Tooltip <Tooltip
popupContent={ popupContent={
<div className="max-w-[180px]">{t(`${i18nPrefix}.roleDescription.${payload.role}`)}</div> <div className="max-w-[180px]">{t(`${i18nPrefix}.roleDescription.${payload.role}` as any) as string}</div>
} }
triggerClassName="w-4 h-4" triggerClassName="w-4 h-4"
/> />

View File

@ -34,7 +34,7 @@ const ConditionValue = ({
const variableSelector = variable_selector as ValueSelector const variableSelector = variable_selector as ValueSelector
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
const formatValue = useCallback((c: Condition) => { const formatValue = useCallback((c: Condition) => {
const notHasValue = comparisonOperatorNotRequireValue(c.comparison_operator) const notHasValue = comparisonOperatorNotRequireValue(c.comparison_operator)
if (notHasValue) if (notHasValue)
@ -59,7 +59,7 @@ const ConditionValue = ({
if (isSelect) { if (isSelect) {
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(c.value) ? c.value[0] : c.value))[0] const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(c.value) ? c.value[0] : c.value))[0]
return name return name
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => { ? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a: string, b: string) => {
const arr: string[] = b.split('.') const arr: string[] = b.split('.')
if (isSystemVar(arr)) if (isSystemVar(arr))
return `{{${b}}}` return `{{${b}}}`
@ -91,9 +91,9 @@ const ConditionValue = ({
sub_variable_condition?.conditions.map((c: Condition, index) => ( sub_variable_condition?.conditions.map((c: Condition, index) => (
<div className="relative flex h-6 items-center space-x-1" key={c.id}> <div className="relative flex h-6 items-center space-x-1" key={c.id}>
<div className="system-xs-medium text-text-accent">{c.key}</div> <div className="system-xs-medium text-text-accent">{c.key}</div>
<div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}`) : c.comparison_operator}</div> <div className="system-xs-medium text-text-primary">{isComparisonOperatorNeedTranslate(c.comparison_operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${c.comparison_operator}` as any) as string : c.comparison_operator}</div>
{c.comparison_operator && !isEmptyRelatedOperator(c.comparison_operator) && <div className="system-xs-regular text-text-secondary">{isSelect(c) ? selectName(c) : formatValue(c)}</div>} {c.comparison_operator && !isEmptyRelatedOperator(c.comparison_operator) && <div className="system-xs-regular text-text-secondary">{isSelect(c) ? selectName(c) : formatValue(c)}</div>}
{index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}`)}</div>)} {index !== sub_variable_condition.conditions.length - 1 && (<div className="absolute bottom-[-10px] right-1 z-10 text-[10px] font-medium uppercase leading-4 text-text-accent">{t(`${i18nPrefix}.${sub_variable_condition.logical_operator}` as any) as string}</div>)}
</div> </div>
)) ))
} }

View File

@ -145,13 +145,13 @@ const ConditionItem = ({
if (isSelect) { if (isSelect) {
if (fileAttr?.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) { if (fileAttr?.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) {
return FILE_TYPE_OPTIONS.map(item => ({ return FILE_TYPE_OPTIONS.map(item => ({
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`), name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
value: item.value, value: item.value,
})) }))
} }
if (fileAttr?.key === 'transfer_method') { if (fileAttr?.key === 'transfer_method') {
return TRANSFER_METHOD.map(item => ({ return TRANSFER_METHOD.map(item => ({
name: t(`${optionNameI18NPrefix}.${item.i18nKey}`), name: t(`${optionNameI18NPrefix}.${item.i18nKey}` as any) as string,
value: item.value, value: item.value,
})) }))
} }

View File

@ -39,7 +39,7 @@ const ConditionOperator = ({
const options = useMemo(() => { const options = useMemo(() => {
return getOperators(varType, file).map((o) => { return getOperators(varType, file).map((o) => {
return { return {
label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}`) : o, label: isComparisonOperatorNeedTranslate(o) ? t(`${i18nPrefix}.comparisonOperator.${o}` as any) as string : o,
value: o, value: o,
} }
}) })
@ -65,7 +65,7 @@ const ConditionOperator = ({
{ {
selectedOption selectedOption
? selectedOption.label ? selectedOption.label
: t(`${i18nPrefix}.select`) : t(`${i18nPrefix}.select` as any) as string
} }
<RiArrowDownSLine className="ml-1 h-3.5 w-3.5" /> <RiArrowDownSLine className="ml-1 h-3.5 w-3.5" />
</Button> </Button>

View File

@ -27,7 +27,7 @@ const ConditionValue = ({
value, value,
}: ConditionValueProps) => { }: ConditionValueProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}`) : operator const operatorName = isComparisonOperatorNeedTranslate(operator) ? t(`workflow.nodes.ifElse.comparisonOperator.${operator}` as any) as string : operator
const notHasValue = comparisonOperatorNotRequireValue(operator) const notHasValue = comparisonOperatorNotRequireValue(operator)
const formatValue = useMemo(() => { const formatValue = useMemo(() => {
if (notHasValue) if (notHasValue)
@ -50,7 +50,7 @@ const ConditionValue = ({
if (isSelect) { if (isSelect) {
const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(value) ? value[0] : value))[0] const name = [...FILE_TYPE_OPTIONS, ...TRANSFER_METHOD].filter(item => item.value === (Array.isArray(value) ? value[0] : value))[0]
return name return name
? t(`workflow.nodes.ifElse.optionName.${name.i18nKey}`).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => { ? (t(`workflow.nodes.ifElse.optionName.${name.i18nKey}` as any) as string).replace(/\{\{#([^#]*)#\}\}/g, (a, b) => {
const arr: string[] = b.split('.') const arr: string[] = b.split('.')
if (isSystemVar(arr)) if (isSystemVar(arr))
return `{{${b}}}` return `{{${b}}}`

View File

@ -30,7 +30,7 @@ const Item = ({
if (!isValid) { if (!isValid) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: t('workflow.env.modal.name') }), message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: t('workflow.env.modal.name') }) as string,
}) })
return false return false
} }

View File

@ -56,7 +56,7 @@ const AddExtractParameter: FC<Props> = ({
if (!isValid) { if (!isValid) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(`appDebug.varKeyError.${errorMessageKey}`, { key: errorKey }), message: t(`appDebug.varKeyError.${errorMessageKey}` as any, { key: errorKey }) as string,
}) })
return return
} }

View File

@ -45,7 +45,7 @@ const VarList: FC<Props> = ({
if (errorMsgKey) { if (errorMsgKey) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(errorMsgKey, { key: t(typeName) }), message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
}) })
return false return false
} }

View File

@ -99,7 +99,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
if (errorMsgKey) { if (errorMsgKey) {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message: t(errorMsgKey, { key: t(typeName) }), message: t(errorMsgKey as any, { key: t(typeName as any) as string }) as string,
}) })
return false return false
} }

Some files were not shown because too many files have changed in this diff Show More