void
size?: 'small' | 'large'
placeholder?: string
+ locale?: string
}
const SearchBox = ({
search,
@@ -20,7 +21,8 @@ const SearchBox = ({
tags,
onTagsChange,
size = 'small',
- placeholder = 'Search tools...',
+ placeholder = '',
+ locale,
}: SearchBoxProps) => {
return (
diff --git a/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx b/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx
index a124d93eb4..dfdc699958 100644
--- a/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx
+++ b/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx
@@ -1,9 +1,16 @@
'use client'
import { useMarketplaceContext } from '../context'
+import { useMixedTranslation } from '../hooks'
import SearchBox from './index'
import cn from '@/utils/classnames'
-const SearchBoxWrapper = () => {
+type SearchBoxWrapperProps = {
+ locale?: string
+}
+const SearchBoxWrapper = ({
+ locale,
+}: SearchBoxWrapperProps) => {
+ const { t } = useMixedTranslation(locale)
const intersected = useMarketplaceContext(v => v.intersected)
const searchPluginText = useMarketplaceContext(v => v.searchPluginText)
const handleSearchPluginTextChange = useMarketplaceContext(v => v.handleSearchPluginTextChange)
@@ -21,6 +28,8 @@ const SearchBoxWrapper = () => {
tags={filterPluginTags}
onTagsChange={handleFilterPluginTagsChange}
size='large'
+ locale={locale}
+ placeholder={t('plugin.searchPlugins')}
/>
)
}
diff --git a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx b/web/app/components/plugins/marketplace/search-box/tags-filter.tsx
index 670d7af6ed..416cc99b91 100644
--- a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx
+++ b/web/app/components/plugins/marketplace/search-box/tags-filter.tsx
@@ -1,7 +1,6 @@
'use client'
import { useState } from 'react'
-import { useTranslation } from 'react-i18next'
import {
RiArrowDownSLine,
RiCloseCircleFill,
@@ -16,21 +15,24 @@ import Checkbox from '@/app/components/base/checkbox'
import cn from '@/utils/classnames'
import Input from '@/app/components/base/input'
import { useTags } from '@/app/components/plugins/hooks'
+import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
type TagsFilterProps = {
tags: string[]
onTagsChange: (tags: string[]) => void
size: 'small' | 'large'
+ locale?: string
}
const TagsFilter = ({
tags,
onTagsChange,
size,
+ locale,
}: TagsFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useMixedTranslation(locale)
const [open, setOpen] = useState(false)
const [searchText, setSearchText] = useState('')
- const { tags: options, tagsMap } = useTags()
+ const { tags: options, tagsMap } = useTags(t)
const filteredOptions = options.filter(option => option.label.toLowerCase().includes(searchText.toLowerCase()))
const handleCheck = (id: string) => {
if (tags.includes(id))
diff --git a/web/app/components/tools/marketplace/index.tsx b/web/app/components/tools/marketplace/index.tsx
index fff22fedc5..f2092227a0 100644
--- a/web/app/components/tools/marketplace/index.tsx
+++ b/web/app/components/tools/marketplace/index.tsx
@@ -1,7 +1,9 @@
import { RiArrowUpDoubleLine } from '@remixicon/react'
+import { useTranslation } from 'react-i18next'
import { useMarketplace } from './hooks'
import List from '@/app/components/plugins/marketplace/list'
import Loading from '@/app/components/base/loading'
+import { getLocaleOnClient } from '@/i18n'
type MarketplaceProps = {
searchPluginText: string
@@ -13,6 +15,8 @@ const Marketplace = ({
filterPluginTags,
onMarketplaceScroll,
}: MarketplaceProps) => {
+ const locale = getLocaleOnClient()
+ const { t } = useTranslation()
const {
isLoading,
marketplaceCollections,
@@ -31,19 +35,19 @@ const Marketplace = ({
Discover
- models
+ {t('plugin.category.models')}
,
- tools
+ {t('plugin.category.tools')}
,
- extensions
+ {t('plugin.category.extensions')}
and
- bundles
+ {t('plugin.category.bundles')}
in Dify Marketplace
@@ -62,6 +66,7 @@ const Marketplace = ({
marketplaceCollectionPluginsMap={marketplaceCollectionPluginsMap || {}}
plugins={plugins}
showInstallButton
+ locale={locale}
/>
)
}
diff --git a/web/i18n/en-US/plugin.ts b/web/i18n/en-US/plugin.ts
index 5ee95468b9..6fbe49a5b7 100644
--- a/web/i18n/en-US/plugin.ts
+++ b/web/i18n/en-US/plugin.ts
@@ -1,4 +1,11 @@
const translation = {
+ category: {
+ models: 'models',
+ tools: 'tools',
+ extensions: 'extensions',
+ bundles: 'bundles',
+ },
+ searchPlugins: 'Search plugins',
from: 'From',
findMoreInMarketplace: 'Find more in Marketplace',
searchInMarketplace: 'Search in Marketplace',
diff --git a/web/i18n/zh-Hans/plugin.ts b/web/i18n/zh-Hans/plugin.ts
index a9acc1e0e3..a7d146181b 100644
--- a/web/i18n/zh-Hans/plugin.ts
+++ b/web/i18n/zh-Hans/plugin.ts
@@ -1,4 +1,11 @@
const translation = {
+ category: {
+ models: '模型',
+ tools: '工具',
+ extensions: '扩展',
+ bundles: '捆绑包',
+ },
+ searchPlugins: '搜索插件',
from: '来自',
findMoreInMarketplace: '在 Marketplace 中查找更多',
searchInMarketplace: '在 Marketplace 中搜索',