fix: marketplace i18n

This commit is contained in:
zxhlyh 2024-12-27 11:54:20 +08:00
parent 697ee496b7
commit 5cdca9cafe
7 changed files with 21 additions and 14 deletions

View File

@ -1,21 +1,23 @@
'use client'
import { useTranslation } from 'react-i18next'
import { Group } from '@/app/components/base/icons/src/vender/other'
import Line from './line'
import cn from '@/utils/classnames'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
type Props = {
text?: string
lightCard?: boolean
className?: string
locale?: string
}
const Empty = ({
text,
lightCard,
className,
locale,
}: Props) => {
const { t } = useTranslation()
const { t } = useMixedTranslation(locale)
return (
<div

View File

@ -69,7 +69,7 @@ const List = ({
}
{
plugins && !plugins.length && (
<Empty className={emptyClassName} />
<Empty className={emptyClassName} locale={locale} />
)
}
</>

View File

@ -1,6 +1,5 @@
'use client'
import { useTranslation } from 'react-i18next'
import { RiArrowRightSLine } from '@remixicon/react'
import type { MarketplaceCollection } from '../types'
import CardWrapper from './card-wrapper'
@ -8,6 +7,7 @@ import type { Plugin } from '@/app/components/plugins/types'
import { getLanguage } from '@/i18n/language'
import cn from '@/utils/classnames'
import type { SearchParamsFromCollection } from '@/app/components/plugins/marketplace/types'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
type ListWithCollectionProps = {
marketplaceCollections: MarketplaceCollection[]
@ -27,7 +27,7 @@ const ListWithCollection = ({
cardRender,
onMoreClick,
}: ListWithCollectionProps) => {
const { t } = useTranslation()
const { t } = useMixedTranslation(locale)
return (
<>

View File

@ -1,12 +1,12 @@
'use client'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import type { Plugin } from '../../types'
import type { MarketplaceCollection } from '../types'
import { useMarketplaceContext } from '../context'
import List from './index'
import SortDropdown from '../sort-dropdown'
import Loading from '@/app/components/base/loading'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
type ListWrapperProps = {
marketplaceCollections: MarketplaceCollection[]
@ -20,7 +20,7 @@ const ListWrapper = ({
showInstallButton,
locale,
}: ListWrapperProps) => {
const { t } = useTranslation()
const { t } = useMixedTranslation(locale)
const plugins = useMarketplaceContext(v => v.plugins)
const pluginsTotal = useMarketplaceContext(v => v.pluginsTotal)
const marketplaceCollectionsFromClient = useMarketplaceContext(v => v.marketplaceCollectionsFromClient)
@ -43,7 +43,7 @@ const ListWrapper = ({
<div className='top-5 flex items-center mb-4 pt-3'>
<div className='title-xl-semi-bold text-text-primary'>{t('plugin.marketplace.pluginsResult', { num: pluginsTotal })}</div>
<div className='mx-3 w-[1px] h-3.5 bg-divider-regular'></div>
<SortDropdown />
<SortDropdown locale={locale} />
</div>
)
}

View File

@ -4,7 +4,7 @@ import {
RiBrain2Line,
RiHammerLine,
RiPuzzle2Line,
RiUmbrellaLine,
RiSpeakAiLine,
} from '@remixicon/react'
import { PluginType } from '../types'
import { useMarketplaceContext } from './context'
@ -50,7 +50,7 @@ const PluginTypeSwitch = ({
{
value: PLUGIN_TYPE_SEARCH_MAP.agent,
text: t('plugin.category.agents'),
icon: <RiUmbrellaLine className='mr-1.5 w-4 h-4' />,
icon: <RiSpeakAiLine className='mr-1.5 w-4 h-4' />,
},
{
value: PLUGIN_TYPE_SEARCH_MAP.extension,

View File

@ -4,16 +4,21 @@ import {
RiArrowDownSLine,
RiCheckLine,
} from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { useMarketplaceContext } from '../context'
import {
PortalToFollowElem,
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
const SortDropdown = () => {
const { t } = useTranslation()
type SortDropdownProps = {
locale?: string
}
const SortDropdown = ({
locale,
}: SortDropdownProps) => {
const { t } = useMixedTranslation(locale)
const options = [
{
value: 'install_count',

View File

@ -3,7 +3,7 @@ const translation = {
all: '全部',
models: '模型',
tools: '工具',
agents: 'Agent Strategy',
agents: 'Agent 策略',
extensions: '扩展',
bundles: '插件集',
},