mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 18:25:55 +08:00
chore: enchance locale props
This commit is contained in:
parent
aa8b525b48
commit
88dbf639e0
@ -4,8 +4,11 @@ import { extensionDallE, modelGPT4, toolNotion } from '@/app/components/plugins/
|
|||||||
import PluginItem from '@/app/components/plugins/plugin-item'
|
import PluginItem from '@/app/components/plugins/plugin-item'
|
||||||
import CardMoreInfo from '@/app/components/plugins/card/card-more-info'
|
import CardMoreInfo from '@/app/components/plugins/card/card-more-info'
|
||||||
import InstallModelItem from '@/app/components/plugins/install-model-item'
|
import InstallModelItem from '@/app/components/plugins/install-model-item'
|
||||||
|
import { getLocaleOnServer } from '@/i18n/server'
|
||||||
|
|
||||||
const PluginList = async () => {
|
const PluginList = async () => {
|
||||||
|
const locale = getLocaleOnServer()
|
||||||
|
|
||||||
const pluginList = [toolNotion, extensionDallE, modelGPT4]
|
const pluginList = [toolNotion, extensionDallE, modelGPT4]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -22,6 +25,7 @@ const PluginList = async () => {
|
|||||||
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
|
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
|
||||||
<Card
|
<Card
|
||||||
payload={toolNotion as any}
|
payload={toolNotion as any}
|
||||||
|
locale={locale}
|
||||||
descriptionLineRows={1}
|
descriptionLineRows={1}
|
||||||
showVersion
|
showVersion
|
||||||
/>
|
/>
|
||||||
@ -30,6 +34,7 @@ const PluginList = async () => {
|
|||||||
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
|
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
|
||||||
<Card
|
<Card
|
||||||
payload={toolNotion as any}
|
payload={toolNotion as any}
|
||||||
|
locale={locale}
|
||||||
descriptionLineRows={1}
|
descriptionLineRows={1}
|
||||||
installed
|
installed
|
||||||
/>
|
/>
|
||||||
@ -49,6 +54,7 @@ const PluginList = async () => {
|
|||||||
<Card
|
<Card
|
||||||
key={index}
|
key={index}
|
||||||
payload={plugin as any}
|
payload={plugin as any}
|
||||||
|
locale={locale}
|
||||||
footer={
|
footer={
|
||||||
<CardMoreInfo downloadCount={index % 2 === 0 ? 1234 : 6} tags={index % 2 === 0 ? ['Search', 'Productivity'] : []} />
|
<CardMoreInfo downloadCount={index % 2 === 0 ? 1234 : 6} tags={index % 2 === 0 ? ['Search', 'Productivity'] : []} />
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,16 @@ import Title from './base/title'
|
|||||||
import OrgInfo from './base/org-info'
|
import OrgInfo from './base/org-info'
|
||||||
import Description from './base/description'
|
import Description from './base/description'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
// import { getLocaleOnServer } from '@/i18n/server'
|
|
||||||
import type { Locale } from '@/i18n'
|
import type { Locale } from '@/i18n'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string
|
className?: string
|
||||||
payload: Plugin
|
payload: Plugin
|
||||||
|
locale: Locale // The component is used in both client and server side, so we can't get the locale from both side(getLocaleOnServer and useContext)
|
||||||
showVersion?: boolean
|
showVersion?: boolean
|
||||||
installed?: boolean
|
installed?: boolean
|
||||||
descriptionLineRows?: number
|
descriptionLineRows?: number
|
||||||
footer?: React.ReactNode
|
footer?: React.ReactNode
|
||||||
clientLocale?: Locale
|
|
||||||
serverLocale?: Locale
|
serverLocale?: Locale
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,10 +28,8 @@ const Card = ({
|
|||||||
installed,
|
installed,
|
||||||
descriptionLineRows = 2,
|
descriptionLineRows = 2,
|
||||||
footer,
|
footer,
|
||||||
clientLocale,
|
locale,
|
||||||
serverLocale,
|
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const locale = clientLocale || serverLocale || 'en'
|
|
||||||
const { type, name, org, label } = payload
|
const { type, name, org, label } = payload
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -39,7 +39,7 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({ onClose
|
|||||||
<Card
|
<Card
|
||||||
key={index}
|
key={index}
|
||||||
payload={plugin as any}
|
payload={plugin as any}
|
||||||
clientLocale={locale}
|
locale={locale}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user