mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
feat: update plugin category labels and improve internationalization support
This commit is contained in:
parent
6298332950
commit
61eb655823
|
@ -11,6 +11,7 @@ import Placeholder from './base/placeholder'
|
|||
import cn from '@/utils/classnames'
|
||||
import { useGetLanguage } from '@/context/i18n'
|
||||
import { getLanguage } from '@/i18n/language'
|
||||
import { useCategories } from '../hooks'
|
||||
|
||||
export type Props = {
|
||||
className?: string
|
||||
|
@ -41,6 +42,7 @@ const Card = ({
|
|||
}: Props) => {
|
||||
const defaultLocale = useGetLanguage()
|
||||
const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale
|
||||
const { categoriesMap } = useCategories()
|
||||
|
||||
const { type, name, org, label, brief, icon, verified } = payload
|
||||
|
||||
|
@ -59,7 +61,7 @@ const Card = ({
|
|||
|
||||
return (
|
||||
<div className={wrapClassName}>
|
||||
{!hideCornerMark && <CornerMark text={type} />}
|
||||
{!hideCornerMark && <CornerMark text={categoriesMap[type].label} />}
|
||||
{/* Header */}
|
||||
<div className="flex">
|
||||
<Icon src={icon} installed={installed} installFailed={installFailed} />
|
||||
|
|
|
@ -100,19 +100,19 @@ export const useCategories = (translateFromOut?: TFunction) => {
|
|||
const categories = [
|
||||
{
|
||||
name: 'model',
|
||||
label: t('pluginCategories.categories.model'),
|
||||
label: t('plugin.category.models'),
|
||||
},
|
||||
{
|
||||
name: 'tool',
|
||||
label: t('pluginCategories.categories.tool'),
|
||||
label: t('plugin.category.tools'),
|
||||
},
|
||||
{
|
||||
name: 'extension',
|
||||
label: t('pluginCategories.categories.extension'),
|
||||
label: t('plugin.category.extensions'),
|
||||
},
|
||||
{
|
||||
name: 'bundle',
|
||||
label: t('pluginCategories.categories.bundle'),
|
||||
label: t('plugin.category.bundles'),
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import cn from '@/utils/classnames'
|
|||
import { API_PREFIX, MARKETPLACE_URL_PREFIX } from '@/config'
|
||||
import { useLanguage } from '../../header/account-setting/model-provider-page/hooks'
|
||||
import { useInvalidateInstalledPluginList } from '@/service/use-plugins'
|
||||
import { useCategories } from '../hooks'
|
||||
|
||||
type Props = {
|
||||
className?: string
|
||||
|
@ -34,6 +35,7 @@ const PluginItem: FC<Props> = ({
|
|||
}) => {
|
||||
const locale = useLanguage()
|
||||
const { t } = useTranslation()
|
||||
const { categoriesMap } = useCategories()
|
||||
const currentPluginDetail = usePluginPageContext(v => v.currentPluginDetail)
|
||||
const setCurrentPluginDetail = usePluginPageContext(v => v.setCurrentPluginDetail)
|
||||
const invalidateInstalledPluginList = useInvalidateInstalledPluginList()
|
||||
|
@ -67,7 +69,7 @@ const PluginItem: FC<Props> = ({
|
|||
}}
|
||||
>
|
||||
<div className={cn('relative p-4 pb-3 border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg hover-bg-components-panel-on-panel-item-bg rounded-xl shadow-xs', className)}>
|
||||
<CornerMark text={t(`pluginCategories.categories.${category}`)} />
|
||||
<CornerMark text={categoriesMap[category].label} />
|
||||
{/* Header */}
|
||||
<div className="flex">
|
||||
<div className='flex items-center justify-center w-10 h-10 overflow-hidden border-components-panel-border-subtle border-[1px] rounded-xl'>
|
||||
|
|
|
@ -56,7 +56,7 @@ const CategoriesFilter = ({
|
|||
'flex items-center p-1 system-sm-medium',
|
||||
)}>
|
||||
{
|
||||
!selectedTagsLength && t('pluginCategories.allCategories')
|
||||
!selectedTagsLength && t('plugin.allCategories')
|
||||
}
|
||||
{
|
||||
!!selectedTagsLength && value.map(val => categoriesMap[val].label).slice(0, 2).join(',')
|
||||
|
@ -96,7 +96,7 @@ const CategoriesFilter = ({
|
|||
showLeftIcon
|
||||
value={searchText}
|
||||
onChange={e => setSearchText(e.target.value)}
|
||||
placeholder={t('pluginCategories.searchCategories')}
|
||||
placeholder={t('plugin.searchCategories')}
|
||||
/>
|
||||
</div>
|
||||
<div className='p-1 max-h-[448px] overflow-y-auto'>
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,12 +0,0 @@
|
|||
const translation = {
|
||||
allCategories: 'All Categories',
|
||||
searchCategories: 'Search categories',
|
||||
categories: {
|
||||
model: 'Model',
|
||||
tool: 'Tool',
|
||||
extension: 'Extension',
|
||||
bundle: 'Bundle',
|
||||
},
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,12 +1,14 @@
|
|||
const translation = {
|
||||
category: {
|
||||
all: 'All',
|
||||
models: 'models',
|
||||
tools: 'tools',
|
||||
extensions: 'extensions',
|
||||
bundles: 'bundles',
|
||||
models: 'Models',
|
||||
tools: 'Tools',
|
||||
extensions: 'Extensions',
|
||||
bundles: 'Bundles',
|
||||
},
|
||||
search: 'Search',
|
||||
allCategories: 'All Categories',
|
||||
searchCategories: 'Search Categories',
|
||||
searchPlugins: 'Search plugins',
|
||||
from: 'From',
|
||||
findMoreInMarketplace: 'Find more in Marketplace',
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -30,7 +30,6 @@ const loadLangResources = (lang: string) => ({
|
|||
runLog: require(`./${lang}/run-log`).default,
|
||||
plugin: require(`./${lang}/plugin`).default,
|
||||
pluginTags: require(`./${lang}/plugin-tags`).default,
|
||||
pluginCategories: require(`./${lang}/plugin-categories`).default,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -1,12 +0,0 @@
|
|||
const translation = {
|
||||
allCategories: '所有类型',
|
||||
searchCategories: '搜索类型',
|
||||
categories: {
|
||||
model: '模型',
|
||||
tool: '工具',
|
||||
extension: '扩展',
|
||||
bundle: '捆绑包',
|
||||
},
|
||||
}
|
||||
|
||||
export default translation
|
|
@ -7,6 +7,8 @@ const translation = {
|
|||
bundles: '捆绑包',
|
||||
},
|
||||
search: '搜索',
|
||||
allCategories: '所有类别',
|
||||
searchCategories: '搜索类别',
|
||||
searchPlugins: '搜索插件',
|
||||
from: '来自',
|
||||
findMoreInMarketplace: '在 Marketplace 中查找更多',
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
const translation = {
|
||||
}
|
||||
|
||||
export default translation
|
Loading…
Reference in New Issue
Block a user