mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
refactor(i18n): use JSON with flattened key and namespace (#30114)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -153,7 +153,7 @@ const AllStartBlocks = ({
|
||||
)}
|
||||
{shouldShowTriggerListTitle && (
|
||||
<div className="px-3 pb-1 pt-2">
|
||||
<span className="system-xs-medium text-text-primary">{t('workflow.tabs.allTriggers')}</span>
|
||||
<span className="system-xs-medium text-text-primary">{t('tabs.allTriggers', { ns: 'workflow' })}</span>
|
||||
</div>
|
||||
)}
|
||||
<StartBlocks
|
||||
@ -189,7 +189,7 @@ const AllStartBlocks = ({
|
||||
<div className="flex h-full flex-col items-center justify-center gap-3 py-12 text-center">
|
||||
<SearchMenu className="h-8 w-8 text-text-quaternary" />
|
||||
<div className="text-sm font-medium text-text-secondary">
|
||||
{t('workflow.tabs.noPluginsFound')}
|
||||
{t('tabs.noPluginsFound', { ns: 'workflow' })}
|
||||
</div>
|
||||
<Link
|
||||
href="https://github.com/langgenius/dify-plugins/issues/new?template=plugin_request.yaml"
|
||||
@ -200,7 +200,7 @@ const AllStartBlocks = ({
|
||||
variant="secondary-accent"
|
||||
className="h-6 cursor-pointer px-3 text-xs"
|
||||
>
|
||||
{t('workflow.tabs.requestToCommunity')}
|
||||
{t('tabs.requestToCommunity', { ns: 'workflow' })}
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
@ -214,7 +214,7 @@ const AllStartBlocks = ({
|
||||
href={getMarketplaceUrl('', { category: PluginCategoryEnum.trigger })}
|
||||
target="_blank"
|
||||
>
|
||||
<span>{t('plugin.findMoreInMarketplace')}</span>
|
||||
<span>{t('findMoreInMarketplace', { ns: 'plugin' })}</span>
|
||||
<RiArrowRightUpLine className="ml-0.5 h-3 w-3" />
|
||||
</Link>
|
||||
)}
|
||||
|
||||
@ -263,7 +263,7 @@ const AllTools = ({
|
||||
{hasToolsListContent && (
|
||||
<>
|
||||
<div className="px-3 pb-1 pt-2">
|
||||
<span className="system-xs-medium text-text-primary">{t('tools.allTools')}</span>
|
||||
<span className="system-xs-medium text-text-primary">{t('allTools', { ns: 'tools' })}</span>
|
||||
</div>
|
||||
<Tools
|
||||
className={toolContentClassName}
|
||||
@ -297,7 +297,7 @@ const AllTools = ({
|
||||
<div className="flex h-full flex-col items-center justify-center gap-3 py-12 text-center">
|
||||
<SearchMenu className="h-8 w-8 text-text-quaternary" />
|
||||
<div className="text-sm font-medium text-text-secondary">
|
||||
{t('workflow.tabs.noPluginsFound')}
|
||||
{t('tabs.noPluginsFound', { ns: 'workflow' })}
|
||||
</div>
|
||||
<Link
|
||||
href="https://github.com/langgenius/dify-plugins/issues/new?template=plugin_request.yaml"
|
||||
@ -308,7 +308,7 @@ const AllTools = ({
|
||||
variant="secondary-accent"
|
||||
className="h-6 cursor-pointer px-3 text-xs"
|
||||
>
|
||||
{t('workflow.tabs.requestToCommunity')}
|
||||
{t('tabs.requestToCommunity', { ns: 'workflow' })}
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
@ -320,7 +320,7 @@ const AllTools = ({
|
||||
href={getMarketplaceUrl('', { category: PluginCategoryEnum.tool })}
|
||||
target="_blank"
|
||||
>
|
||||
<span>{t('plugin.findMoreInMarketplace')}</span>
|
||||
<span>{t('findMoreInMarketplace', { ns: 'plugin' })}</span>
|
||||
<RiArrowRightUpLine className="ml-0.5 h-3 w-3" />
|
||||
</Link>
|
||||
)}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import type { NodeDefault } from '../types'
|
||||
import type { BlockClassificationEnum } from './types'
|
||||
import { groupBy } from 'es-toolkit/compat'
|
||||
import {
|
||||
memo,
|
||||
@ -38,6 +39,7 @@ const Blocks = ({
|
||||
type: block.type,
|
||||
title: block.title,
|
||||
author: 'Dify',
|
||||
// @ts-expect-error Fix this missing field later
|
||||
description: block.description,
|
||||
},
|
||||
defaultValue: {},
|
||||
@ -66,7 +68,7 @@ const Blocks = ({
|
||||
}, [blocks, searchText, availableBlocksTypes])
|
||||
const isEmpty = Object.values(groups).every(list => !list.length)
|
||||
|
||||
const renderGroup = useCallback((classification: string) => {
|
||||
const renderGroup = useCallback((classification: BlockClassificationEnum) => {
|
||||
const list = groups[classification].sort((a, b) => (a.metaData.sort || 0) - (b.metaData.sort || 0))
|
||||
const { getNodes } = store.getState()
|
||||
const nodes = getNodes()
|
||||
@ -85,7 +87,7 @@ const Blocks = ({
|
||||
{
|
||||
classification !== '-' && !!filteredList.length && (
|
||||
<div className="flex h-[22px] items-start px-3 text-xs font-medium text-text-tertiary">
|
||||
{t(`workflow.tabs.${classification}` as any) as string}
|
||||
{t(`tabs.${classification}`, { ns: 'workflow' })}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -121,7 +123,7 @@ const Blocks = ({
|
||||
{
|
||||
block.metaData.type === BlockEnum.LoopEnd && (
|
||||
<Badge
|
||||
text={t('workflow.nodes.loop.loopNode')}
|
||||
text={t('nodes.loop.loopNode', { ns: 'workflow' })}
|
||||
className="ml-2 shrink-0"
|
||||
/>
|
||||
)
|
||||
@ -138,7 +140,7 @@ const Blocks = ({
|
||||
<div className="max-h-[480px] max-w-[500px] overflow-y-auto p-1">
|
||||
{
|
||||
isEmpty && (
|
||||
<div className="flex h-[22px] items-center px-3 text-xs font-medium text-text-tertiary">{t('workflow.tabs.noResult')}</div>
|
||||
<div className="flex h-[22px] items-center px-3 text-xs font-medium text-text-tertiary">{t('tabs.noResult', { ns: 'workflow' })}</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
|
||||
@ -2,13 +2,13 @@ import type { Block } from '../types'
|
||||
import { BlockEnum } from '../types'
|
||||
import { BlockClassificationEnum } from './types'
|
||||
|
||||
export const BLOCK_CLASSIFICATIONS: string[] = [
|
||||
export const BLOCK_CLASSIFICATIONS = [
|
||||
BlockClassificationEnum.Default,
|
||||
BlockClassificationEnum.QuestionUnderstand,
|
||||
BlockClassificationEnum.Logic,
|
||||
BlockClassificationEnum.Transform,
|
||||
BlockClassificationEnum.Utilities,
|
||||
]
|
||||
] as const
|
||||
|
||||
export const DEFAULT_FILE_EXTENSIONS_IN_LOCAL_FILE_DATA_SOURCE = [
|
||||
'txt',
|
||||
@ -32,7 +32,7 @@ export const DEFAULT_FILE_EXTENSIONS_IN_LOCAL_FILE_DATA_SOURCE = [
|
||||
'md',
|
||||
]
|
||||
|
||||
export const START_BLOCKS: Block[] = [
|
||||
export const START_BLOCKS = [
|
||||
{
|
||||
classification: BlockClassificationEnum.Default,
|
||||
type: BlockEnum.Start,
|
||||
@ -51,7 +51,7 @@ export const START_BLOCKS: Block[] = [
|
||||
title: 'Webhook Trigger',
|
||||
description: 'HTTP callback trigger',
|
||||
},
|
||||
]
|
||||
] as const satisfies readonly Block[]
|
||||
|
||||
export const ENTRY_NODE_TYPES = [
|
||||
BlockEnum.Start,
|
||||
@ -60,7 +60,7 @@ export const ENTRY_NODE_TYPES = [
|
||||
BlockEnum.TriggerPlugin,
|
||||
] as const
|
||||
|
||||
export const BLOCKS: Block[] = [
|
||||
export const BLOCKS = [
|
||||
{
|
||||
classification: BlockClassificationEnum.Default,
|
||||
type: BlockEnum.LLM,
|
||||
@ -152,4 +152,4 @@ export const BLOCKS: Block[] = [
|
||||
type: BlockEnum.Agent,
|
||||
title: 'Agent',
|
||||
},
|
||||
]
|
||||
] as const satisfies readonly Block[]
|
||||
|
||||
@ -133,7 +133,7 @@ const FeaturedTools = ({
|
||||
className="flex w-full items-center rounded-md px-0 py-1 text-left text-text-primary"
|
||||
onClick={() => setIsCollapsed(prev => !prev)}
|
||||
>
|
||||
<span className="system-xs-medium text-text-primary">{t('workflow.tabs.featuredTools')}</span>
|
||||
<span className="system-xs-medium text-text-primary">{t('tabs.featuredTools', { ns: 'workflow' })}</span>
|
||||
<ArrowDownRoundFill className={`ml-0.5 h-4 w-4 text-text-tertiary transition-transform ${isCollapsed ? '-rotate-90' : 'rotate-0'}`} />
|
||||
</button>
|
||||
|
||||
@ -148,7 +148,7 @@ const FeaturedTools = ({
|
||||
{showEmptyState && (
|
||||
<p className="system-xs-regular py-2 text-text-tertiary">
|
||||
<Link className="text-text-accent" href={getMarketplaceUrl('', { category: 'tool' })} target="_blank" rel="noopener noreferrer">
|
||||
{t('workflow.tabs.noFeaturedPlugins')}
|
||||
{t('tabs.noFeaturedPlugins', { ns: 'workflow' })}
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
@ -210,7 +210,7 @@ const FeaturedTools = ({
|
||||
)}
|
||||
</div>
|
||||
<div className="system-xs-regular">
|
||||
{t(isExpanded ? 'workflow.tabs.showLessFeatured' : 'workflow.tabs.showMoreFeatured')}
|
||||
{t(isExpanded ? 'tabs.showLessFeatured' : 'tabs.showMoreFeatured', { ns: 'workflow' })}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@ -235,7 +235,7 @@ function FeaturedToolUninstalledItem({
|
||||
}: FeaturedToolUninstalledItemProps) {
|
||||
const label = plugin.label?.[language] || plugin.name
|
||||
const description = typeof plugin.brief === 'object' ? plugin.brief[language] : plugin.brief
|
||||
const installCountLabel = t('plugin.install', { num: formatNumber(plugin.install_count || 0) })
|
||||
const installCountLabel = t('install', { ns: 'plugin', num: formatNumber(plugin.install_count || 0) })
|
||||
const [actionOpen, setActionOpen] = useState(false)
|
||||
const [isActionHovered, setIsActionHovered] = useState(false)
|
||||
const [isInstallModalOpen, setIsInstallModalOpen] = useState(false)
|
||||
@ -299,7 +299,7 @@ function FeaturedToolUninstalledItem({
|
||||
setIsActionHovered(true)
|
||||
}}
|
||||
>
|
||||
{t('plugin.installAction')}
|
||||
{t('installAction', { ns: 'plugin' })}
|
||||
</button>
|
||||
<Action
|
||||
open={actionOpen}
|
||||
|
||||
@ -126,7 +126,7 @@ const FeaturedTriggers = ({
|
||||
className="flex w-full items-center rounded-md px-0 py-1 text-left text-text-primary"
|
||||
onClick={() => setIsCollapsed(prev => !prev)}
|
||||
>
|
||||
<span className="system-xs-medium text-text-primary">{t('workflow.tabs.featuredTools')}</span>
|
||||
<span className="system-xs-medium text-text-primary">{t('tabs.featuredTools', { ns: 'workflow' })}</span>
|
||||
<ArrowDownRoundFill className={`ml-0.5 h-4 w-4 text-text-tertiary transition-transform ${isCollapsed ? '-rotate-90' : 'rotate-0'}`} />
|
||||
</button>
|
||||
|
||||
@ -141,7 +141,7 @@ const FeaturedTriggers = ({
|
||||
{showEmptyState && (
|
||||
<p className="system-xs-regular py-2 text-text-tertiary">
|
||||
<Link className="text-text-accent" href={getMarketplaceUrl('', { category: 'trigger' })} target="_blank" rel="noopener noreferrer">
|
||||
{t('workflow.tabs.noFeaturedTriggers')}
|
||||
{t('tabs.noFeaturedTriggers', { ns: 'workflow' })}
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
@ -202,7 +202,7 @@ const FeaturedTriggers = ({
|
||||
)}
|
||||
</div>
|
||||
<div className="system-xs-regular">
|
||||
{t(isExpanded ? 'workflow.tabs.showLessFeatured' : 'workflow.tabs.showMoreFeatured')}
|
||||
{t(isExpanded ? 'tabs.showLessFeatured' : 'tabs.showMoreFeatured', { ns: 'workflow' })}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@ -227,7 +227,7 @@ function FeaturedTriggerUninstalledItem({
|
||||
}: FeaturedTriggerUninstalledItemProps) {
|
||||
const label = plugin.label?.[language] || plugin.name
|
||||
const description = typeof plugin.brief === 'object' ? plugin.brief[language] : plugin.brief
|
||||
const installCountLabel = t('plugin.install', { num: formatNumber(plugin.install_count || 0) })
|
||||
const installCountLabel = t('install', { ns: 'plugin', num: formatNumber(plugin.install_count || 0) })
|
||||
const [actionOpen, setActionOpen] = useState(false)
|
||||
const [isActionHovered, setIsActionHovered] = useState(false)
|
||||
const [isInstallModalOpen, setIsInstallModalOpen] = useState(false)
|
||||
@ -291,7 +291,7 @@ function FeaturedTriggerUninstalledItem({
|
||||
setIsActionHovered(true)
|
||||
}}
|
||||
>
|
||||
{t('plugin.installAction')}
|
||||
{t('installAction', { ns: 'plugin' })}
|
||||
</button>
|
||||
<Action
|
||||
open={actionOpen}
|
||||
|
||||
@ -17,7 +17,7 @@ export const useBlocks = () => {
|
||||
return BLOCKS.map((block) => {
|
||||
return {
|
||||
...block,
|
||||
title: t(`workflow.blocks.${block.type}` as any) as string,
|
||||
title: t(`blocks.${block.type}`, { ns: 'workflow' }),
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -28,7 +28,7 @@ export const useStartBlocks = () => {
|
||||
return START_BLOCKS.map((block) => {
|
||||
return {
|
||||
...block,
|
||||
title: t(`workflow.blocks.${block.type}` as any) as string,
|
||||
title: t(`blocks.${block.type}`, { ns: 'workflow' }),
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -56,19 +56,19 @@ export const useTabs = ({
|
||||
const tabs = useMemo(() => {
|
||||
const tabConfigs = [{
|
||||
key: TabsEnum.Blocks,
|
||||
name: t('workflow.tabs.blocks'),
|
||||
name: t('tabs.blocks', { ns: 'workflow' }),
|
||||
show: !noBlocks,
|
||||
}, {
|
||||
key: TabsEnum.Sources,
|
||||
name: t('workflow.tabs.sources'),
|
||||
name: t('tabs.sources', { ns: 'workflow' }),
|
||||
show: !noSources,
|
||||
}, {
|
||||
key: TabsEnum.Tools,
|
||||
name: t('workflow.tabs.tools'),
|
||||
name: t('tabs.tools', { ns: 'workflow' }),
|
||||
show: !noTools,
|
||||
}, {
|
||||
key: TabsEnum.Start,
|
||||
name: t('workflow.tabs.start'),
|
||||
name: t('tabs.start', { ns: 'workflow' }),
|
||||
show: shouldShowStartTab,
|
||||
disabled: shouldDisableStartTab,
|
||||
}]
|
||||
@ -129,19 +129,19 @@ export const useToolTabs = (isHideMCPTools?: boolean) => {
|
||||
const tabs = [
|
||||
{
|
||||
key: ToolTypeEnum.All,
|
||||
name: t('workflow.tabs.allTool'),
|
||||
name: t('tabs.allTool', { ns: 'workflow' }),
|
||||
},
|
||||
{
|
||||
key: ToolTypeEnum.BuiltIn,
|
||||
name: t('workflow.tabs.plugin'),
|
||||
name: t('tabs.plugin', { ns: 'workflow' }),
|
||||
},
|
||||
{
|
||||
key: ToolTypeEnum.Custom,
|
||||
name: t('workflow.tabs.customTool'),
|
||||
name: t('tabs.customTool', { ns: 'workflow' }),
|
||||
},
|
||||
{
|
||||
key: ToolTypeEnum.Workflow,
|
||||
name: t('workflow.tabs.workflowTool'),
|
||||
name: t('tabs.workflowTool', { ns: 'workflow' }),
|
||||
},
|
||||
]
|
||||
if (!isHideMCPTools) {
|
||||
|
||||
@ -161,16 +161,16 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
||||
|
||||
const searchPlaceholder = useMemo(() => {
|
||||
if (activeTab === TabsEnum.Start)
|
||||
return t('workflow.tabs.searchTrigger')
|
||||
return t('tabs.searchTrigger', { ns: 'workflow' })
|
||||
|
||||
if (activeTab === TabsEnum.Blocks)
|
||||
return t('workflow.tabs.searchBlock')
|
||||
return t('tabs.searchBlock', { ns: 'workflow' })
|
||||
|
||||
if (activeTab === TabsEnum.Tools)
|
||||
return t('workflow.tabs.searchTool')
|
||||
return t('tabs.searchTool', { ns: 'workflow' })
|
||||
|
||||
if (activeTab === TabsEnum.Sources)
|
||||
return t('workflow.tabs.searchDataSource')
|
||||
return t('tabs.searchDataSource', { ns: 'workflow' })
|
||||
return ''
|
||||
}, [activeTab, t])
|
||||
|
||||
@ -253,7 +253,7 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
||||
onSearchChange={setSearchText}
|
||||
tags={tags}
|
||||
onTagsChange={setTags}
|
||||
placeholder={t('plugin.searchTools')!}
|
||||
placeholder={t('searchTools', { ns: 'plugin' })!}
|
||||
inputClassName="grow"
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -91,8 +91,8 @@ const OperationDropdown: FC<Props> = ({
|
||||
</PortalToFollowElemTrigger>
|
||||
<PortalToFollowElemContent className="z-[9999]">
|
||||
<div className="min-w-[176px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg">
|
||||
<div onClick={handleDownload} className="system-md-regular cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover">{t('common.operation.download')}</div>
|
||||
<a href={getMarketplaceUrl(`/plugins/${author}/${name}`, { theme })} target="_blank" className="system-md-regular block cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover">{t('common.operation.viewDetails')}</a>
|
||||
<div onClick={handleDownload} className="system-md-regular cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover">{t('operation.download', { ns: 'common' })}</div>
|
||||
<a href={getMarketplaceUrl(`/plugins/${author}/${name}`, { theme })} target="_blank" className="system-md-regular block cursor-pointer rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover">{t('operation.viewDetails', { ns: 'common' })}</a>
|
||||
</div>
|
||||
</PortalToFollowElemContent>
|
||||
</PortalToFollowElem>
|
||||
|
||||
@ -48,7 +48,7 @@ const Item: FC<Props> = ({
|
||||
<div className="system-xs-regular flex space-x-1 text-text-tertiary">
|
||||
<div>{payload.org}</div>
|
||||
<div>·</div>
|
||||
<div>{t('plugin.install', { num: formatNumber(payload.install_count || 0) })}</div>
|
||||
<div>{t('install', { ns: 'plugin', num: formatNumber(payload.install_count || 0) })}</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Action */}
|
||||
@ -57,7 +57,7 @@ const Item: FC<Props> = ({
|
||||
className="cursor-pointer rounded-md px-1.5 py-0.5 hover:bg-state-base-hover"
|
||||
onClick={showInstallModal}
|
||||
>
|
||||
{t('plugin.installAction')}
|
||||
{t('installAction', { ns: 'plugin' })}
|
||||
</div>
|
||||
<Action
|
||||
open={open}
|
||||
|
||||
@ -83,7 +83,7 @@ const List = ({
|
||||
href={getMarketplaceUrl('', { category })}
|
||||
target="_blank"
|
||||
>
|
||||
<span>{t('plugin.findMoreInMarketplace')}</span>
|
||||
<span>{t('findMoreInMarketplace', { ns: 'plugin' })}</span>
|
||||
<RiArrowRightUpLine className="ml-0.5 h-3 w-3" />
|
||||
</Link>
|
||||
)
|
||||
@ -98,14 +98,14 @@ const List = ({
|
||||
className={cn('system-sm-medium sticky z-10 flex h-8 cursor-pointer justify-between px-4 py-1 text-text-primary', stickyClassName, !disableMaxWidth && maxWidthClassName)}
|
||||
onClick={handleHeadClick}
|
||||
>
|
||||
<span>{t('plugin.fromMarketplace')}</span>
|
||||
<span>{t('fromMarketplace', { ns: 'plugin' })}</span>
|
||||
<Link
|
||||
href={urlWithSearchText}
|
||||
target="_blank"
|
||||
className="flex items-center text-text-accent-light-mode-only"
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
<span>{t('plugin.searchInMarketplace')}</span>
|
||||
<span>{t('searchInMarketplace', { ns: 'plugin' })}</span>
|
||||
<RiArrowRightUpLine className="ml-0.5 h-3 w-3" />
|
||||
</Link>
|
||||
</div>
|
||||
@ -127,7 +127,7 @@ const List = ({
|
||||
className="system-sm-medium flex h-4 shrink-0 items-center text-text-accent-light-mode-only"
|
||||
>
|
||||
<RiSearchLine className="mr-0.5 h-3 w-3" />
|
||||
<span>{t('plugin.searchInMarketplace')}</span>
|
||||
<span>{t('searchInMarketplace', { ns: 'plugin' })}</span>
|
||||
</Link>
|
||||
<div className="h-[2px] w-[90px] bg-gradient-to-l from-[rgba(255,255,255,0.01)] to-[rgba(16,24,40,0.08)]"></div>
|
||||
</div>
|
||||
|
||||
@ -82,7 +82,7 @@ const RAGToolRecommendations = ({
|
||||
className="flex w-full items-center rounded-md px-3 pb-0.5 pt-1 text-left text-text-tertiary"
|
||||
onClick={() => setIsCollapsed(prev => !prev)}
|
||||
>
|
||||
<span className="system-xs-medium text-text-tertiary">{t('pipeline.ragToolSuggestions.title')}</span>
|
||||
<span className="system-xs-medium text-text-tertiary">{t('ragToolSuggestions.title', { ns: 'pipeline' })}</span>
|
||||
<ArrowDownRoundFill className={`ml-1 h-4 w-4 text-text-tertiary transition-transform ${isCollapsed ? '-rotate-90' : 'rotate-0'}`} />
|
||||
</button>
|
||||
{!isCollapsed && (
|
||||
@ -126,7 +126,7 @@ const RAGToolRecommendations = ({
|
||||
<RiMoreLine className="size-4 text-text-tertiary" />
|
||||
</div>
|
||||
<div className="system-xs-regular text-text-tertiary">
|
||||
{t('common.operation.more')}
|
||||
{t('operation.more', { ns: 'common' })}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@ -46,7 +46,7 @@ const UninstalledItem = ({
|
||||
className="system-xs-medium cursor-pointer pl-1.5 text-components-button-secondary-accent-text"
|
||||
onClick={showInstallModal}
|
||||
>
|
||||
{t('plugin.installAction')}
|
||||
{t('installAction', { ns: 'plugin' })}
|
||||
</div>
|
||||
{isShowInstallModal && (
|
||||
<InstallFromMarketplace
|
||||
|
||||
@ -41,9 +41,9 @@ const StartBlocks = ({
|
||||
const normalizedSearch = searchText.toLowerCase()
|
||||
const getDisplayName = (blockType: BlockEnum) => {
|
||||
if (blockType === BlockEnumValues.TriggerWebhook)
|
||||
return t('workflow.customWebhook')
|
||||
return t('customWebhook', { ns: 'workflow' })
|
||||
|
||||
return t(`workflow.blocks.${blockType}` as any) as string
|
||||
return t(`blocks.${blockType}`, { ns: 'workflow' })
|
||||
}
|
||||
|
||||
return START_BLOCKS.filter((block) => {
|
||||
@ -67,7 +67,7 @@ const StartBlocks = ({
|
||||
onContentStateChange?.(!isEmpty)
|
||||
}, [isEmpty, onContentStateChange])
|
||||
|
||||
const renderBlock = useCallback((block: { type: BlockEnum, title: string, description?: string }) => (
|
||||
const renderBlock = useCallback((block: typeof START_BLOCKS[number]) => (
|
||||
<Tooltip
|
||||
key={block.type}
|
||||
position="right"
|
||||
@ -82,17 +82,17 @@ const StartBlocks = ({
|
||||
/>
|
||||
<div className="system-md-medium mb-1 text-text-primary">
|
||||
{block.type === BlockEnumValues.TriggerWebhook
|
||||
? t('workflow.customWebhook')
|
||||
: t(`workflow.blocks.${block.type}` as any) as string}
|
||||
? t('customWebhook', { ns: 'workflow' })
|
||||
: t(`blocks.${block.type}`, { ns: 'workflow' })}
|
||||
</div>
|
||||
<div className="system-xs-regular text-text-secondary">
|
||||
{t(`workflow.blocksAbout.${block.type}` as any) as string}
|
||||
{t(`blocksAbout.${block.type}`, { ns: 'workflow' })}
|
||||
</div>
|
||||
{(block.type === BlockEnumValues.TriggerWebhook || block.type === BlockEnumValues.TriggerSchedule) && (
|
||||
<div className="system-xs-regular mb-1 mt-1 text-text-tertiary">
|
||||
{t('tools.author')}
|
||||
{t('author', { ns: 'tools' })}
|
||||
{' '}
|
||||
{t('workflow.difyTeam')}
|
||||
{t('difyTeam', { ns: 'workflow' })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@ -107,9 +107,9 @@ const StartBlocks = ({
|
||||
type={block.type}
|
||||
/>
|
||||
<div className="flex w-0 grow items-center justify-between text-sm text-text-secondary">
|
||||
<span className="truncate">{t(`workflow.blocks.${block.type}` as any) as string}</span>
|
||||
<span className="truncate">{t(`blocks.${block.type}`, { ns: 'workflow' })}</span>
|
||||
{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('blocks.originalStartNode', { ns: 'workflow' })}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -154,7 +154,7 @@ const Tabs: FC<TabsProps> = ({
|
||||
key={tab.key}
|
||||
position="top"
|
||||
popupClassName="max-w-[200px]"
|
||||
popupContent={t('workflow.tabs.startDisabledTip')}
|
||||
popupContent={t('tabs.startDisabledTip', { ns: 'workflow' })}
|
||||
>
|
||||
<div {...commonProps}>
|
||||
{tab.name}
|
||||
|
||||
@ -141,7 +141,7 @@ const ToolPicker: FC<Props> = ({
|
||||
await createCustomCollection(data)
|
||||
Toast.notify({
|
||||
type: 'success',
|
||||
message: t('common.api.actionSuccess'),
|
||||
message: t('api.actionSuccess', { ns: 'common' }),
|
||||
})
|
||||
hideEditCustomCollectionModal()
|
||||
handleAddedCustomTool()
|
||||
@ -179,7 +179,7 @@ const ToolPicker: FC<Props> = ({
|
||||
onSearchChange={setSearchText}
|
||||
tags={tags}
|
||||
onTagsChange={setTags}
|
||||
placeholder={t('plugin.searchTools')!}
|
||||
placeholder={t('searchTools', { ns: 'plugin' })!}
|
||||
supportAddCustomTool={supportAddCustomTool}
|
||||
onAddedCustomTool={handleAddedCustomTool}
|
||||
onShowAddCustomCollectionModal={showEditCustomCollectionModal}
|
||||
|
||||
@ -115,7 +115,7 @@ const ToolItem: FC<Props> = ({
|
||||
<span className={cn(disabled && 'opacity-30')}>{payload.label[language]}</span>
|
||||
</div>
|
||||
{isAdded && (
|
||||
<div className="system-xs-regular mr-4 text-text-tertiary">{t('tools.addToolModal.added')}</div>
|
||||
<div className="system-xs-regular mr-4 text-text-tertiary">{t('addToolModal.added', { ns: 'tools' })}</div>
|
||||
)}
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
@ -30,13 +30,13 @@ const ToolListTreeView: FC<Props> = ({
|
||||
const { t } = useTranslation()
|
||||
const getI18nGroupName = useCallback((name: string) => {
|
||||
if (name === CUSTOM_GROUP_NAME)
|
||||
return t('workflow.tabs.customTool')
|
||||
return t('tabs.customTool', { ns: 'workflow' })
|
||||
|
||||
if (name === WORKFLOW_GROUP_NAME)
|
||||
return t('workflow.tabs.workflowTool')
|
||||
return t('tabs.workflowTool', { ns: 'workflow' })
|
||||
|
||||
if (name === AGENT_GROUP_NAME)
|
||||
return t('workflow.tabs.agent')
|
||||
return t('tabs.agent', { ns: 'workflow' })
|
||||
|
||||
return name
|
||||
}, [t])
|
||||
|
||||
@ -92,7 +92,7 @@ const Tool: FC<Props> = ({
|
||||
if (isAllSelected) {
|
||||
return (
|
||||
<span className="system-xs-regular text-text-tertiary">
|
||||
{t('tools.addToolModal.added')}
|
||||
{t('addToolModal.added', { ns: 'tools' })}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@ -129,7 +129,7 @@ const Tool: FC<Props> = ({
|
||||
}))
|
||||
}}
|
||||
>
|
||||
{t('workflow.tabs.addAll')}
|
||||
{t('tabs.addAll', { ns: 'workflow' })}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@ -140,7 +140,7 @@ const Tool: FC<Props> = ({
|
||||
return (
|
||||
<span className="system-xs-regular text-text-tertiary">
|
||||
{isAllSelected
|
||||
? t('workflow.tabs.allAdded')
|
||||
? t('tabs.allAdded', { ns: 'workflow' })
|
||||
: `${selectedToolsNum} / ${totalToolsNum}`}
|
||||
</span>
|
||||
)
|
||||
@ -162,10 +162,10 @@ const Tool: FC<Props> = ({
|
||||
return payload.author
|
||||
|
||||
if (payload.type === CollectionType.custom)
|
||||
return t('workflow.tabs.customTool')
|
||||
return t('tabs.customTool', { ns: 'workflow' })
|
||||
|
||||
if (payload.type === CollectionType.workflow)
|
||||
return t('workflow.tabs.workflowTool')
|
||||
return t('tabs.workflowTool', { ns: 'workflow' })
|
||||
|
||||
return ''
|
||||
}, [payload.author, payload.type, t])
|
||||
|
||||
@ -81,7 +81,7 @@ const TriggerPluginActionItem: FC<Props> = ({
|
||||
<span className={cn(disabled && 'opacity-30')}>{payload.label[language]}</span>
|
||||
</div>
|
||||
{isAdded && (
|
||||
<div className="system-xs-regular mr-4 text-text-tertiary">{t('tools.addToolModal.added')}</div>
|
||||
<div className="system-xs-regular mr-4 text-text-tertiary">{t('addToolModal.added', { ns: 'tools' })}</div>
|
||||
)}
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
@ -61,10 +61,10 @@ const TriggerPluginItem: FC<Props> = ({
|
||||
return payload.author
|
||||
|
||||
if (payload.type === CollectionType.custom)
|
||||
return t('workflow.tabs.customTool')
|
||||
return t('tabs.customTool', { ns: 'workflow' })
|
||||
|
||||
if (payload.type === CollectionType.workflow)
|
||||
return t('workflow.tabs.workflowTool')
|
||||
return t('tabs.workflowTool', { ns: 'workflow' })
|
||||
|
||||
return payload.author || ''
|
||||
}, [payload.author, payload.type, t])
|
||||
|
||||
Reference in New Issue
Block a user