mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
feat: document dataset i18n
This commit is contained in:
@ -4,6 +4,7 @@ import React from 'react'
|
|||||||
import Button from '../../base/button'
|
import Button from '../../base/button'
|
||||||
import { RiAddLine } from '@remixicon/react'
|
import { RiAddLine } from '@remixicon/react'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
className?: string
|
className?: string
|
||||||
@ -14,6 +15,7 @@ const AddedMetadataButton: FC<Props> = ({
|
|||||||
className,
|
className,
|
||||||
onClick,
|
onClick,
|
||||||
}) => {
|
}) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
className={cn('w-full flex items-center', className)}
|
className={cn('w-full flex items-center', className)}
|
||||||
@ -22,7 +24,7 @@ const AddedMetadataButton: FC<Props> = ({
|
|||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<RiAddLine className='mr-1 size-3.5' />
|
<RiAddLine className='mr-1 size-3.5' />
|
||||||
<div>Add metadata</div>
|
<div>{t('dataset.metadata.addMetadata')}</div>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import { RiEditLine } from '@remixicon/react'
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import Divider from '@/app/components/base/divider'
|
import Divider from '@/app/components/base/divider'
|
||||||
|
|
||||||
|
const i18nPrefix = 'dataset.metadata.documentMetadata'
|
||||||
|
|
||||||
const MetadataDocument: FC = () => {
|
const MetadataDocument: FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [isEdit, setIsEdit] = useState(true)
|
const [isEdit, setIsEdit] = useState(true)
|
||||||
@ -48,13 +50,13 @@ const MetadataDocument: FC = () => {
|
|||||||
const documentInfoList = builtList
|
const documentInfoList = builtList
|
||||||
const technicalParams = builtList
|
const technicalParams = builtList
|
||||||
return (
|
return (
|
||||||
<div className='space-y-4'>
|
<div className='w-[388px] space-y-4'>
|
||||||
{hasData ? (
|
{!hasData ? (
|
||||||
<div>
|
<div>
|
||||||
<InfoGroup
|
<InfoGroup
|
||||||
title='Metadata'
|
title={t('dataset.metadata.metadata')}
|
||||||
uppercaseTitle={false}
|
uppercaseTitle={false}
|
||||||
titleTooltip='Metadata serves as a critical filter that enhances the accuracy and relevance of information retrieval. You can modify and add metadata for this document here.'
|
titleTooltip={t(`${i18nPrefix}.metadataToolTip`)}
|
||||||
list={isEdit ? tempList : list}
|
list={isEdit ? tempList : list}
|
||||||
headerRight={isEdit ? (
|
headerRight={isEdit ? (
|
||||||
<div className='flex space-x-1'>
|
<div className='flex space-x-1'>
|
||||||
@ -109,12 +111,12 @@ const MetadataDocument: FC = () => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<InfoGroup
|
<InfoGroup
|
||||||
title='Document Information'
|
title={t(`${i18nPrefix}.documentInformation`)}
|
||||||
list={builtList}
|
list={documentInfoList}
|
||||||
/>
|
/>
|
||||||
<InfoGroup
|
<InfoGroup
|
||||||
title='Technical Parameters'
|
title={t(`${i18nPrefix}.technicalParameters`)}
|
||||||
list={builtList}
|
list={technicalParams}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -16,9 +16,9 @@ const NoData: FC<Props> = ({
|
|||||||
return (
|
return (
|
||||||
<div className='p-4 pt-3 rounded-xl bg-gradient-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2'>
|
<div className='p-4 pt-3 rounded-xl bg-gradient-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2'>
|
||||||
<div className='text-text-secondary text-xs font-semibold leading-5'>{t('dataset.metadata.metadata')}</div>
|
<div className='text-text-secondary text-xs font-semibold leading-5'>{t('dataset.metadata.metadata')}</div>
|
||||||
<div className='mt-1 system-xs-regular text-text-tertiary'>Metadata serves as a critical filter that enhances the accuracy and relevance of information retrieval. You can modify and add metadata for this document here.</div>
|
<div className='mt-1 system-xs-regular text-text-tertiary'>{t('dataset.metadata.documentMetadata.metadataToolTip')}</div>
|
||||||
<Button variant='primary' className='mt-2' onClick={onStart}>
|
<Button variant='primary' className='mt-2' onClick={onStart}>
|
||||||
<div>Start labeling</div>
|
<div>{t('dataset.metadata.documentMetadata.startLabeling')}</div>
|
||||||
<RiArrowRightLine className='ml-1 size-4' />
|
<RiArrowRightLine className='ml-1 size-4' />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -170,6 +170,7 @@ const translation = {
|
|||||||
allKnowledgeDescription: 'Select to display all knowledge in this workspace. Only the Workspace Owner can manage all knowledge.',
|
allKnowledgeDescription: 'Select to display all knowledge in this workspace. Only the Workspace Owner can manage all knowledge.',
|
||||||
metadata: {
|
metadata: {
|
||||||
metadata: 'Metadata',
|
metadata: 'Metadata',
|
||||||
|
addMetadata: 'Add Metadata',
|
||||||
createMetadata: {
|
createMetadata: {
|
||||||
title: 'New Metadata',
|
title: 'New Metadata',
|
||||||
back: 'Back',
|
back: 'Back',
|
||||||
@ -193,6 +194,12 @@ const translation = {
|
|||||||
builtIn: 'Built-in',
|
builtIn: 'Built-in',
|
||||||
builtInDescription: 'Built-in metadata is automatically extracted and generated. It must be enabled before use and cannot be edited.',
|
builtInDescription: 'Built-in metadata is automatically extracted and generated. It must be enabled before use and cannot be edited.',
|
||||||
},
|
},
|
||||||
|
documentMetadata: {
|
||||||
|
metadataToolTip: 'Metadata serves as a critical filter that enhances the accuracy and relevance of information retrieval. You can modify and add metadata for this document here.',
|
||||||
|
startLabeling: 'Start Labeling',
|
||||||
|
documentInformation: 'Document Information',
|
||||||
|
technicalParameters: 'Technical Parameters',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -170,6 +170,7 @@ const translation = {
|
|||||||
allKnowledgeDescription: '选择以显示该工作区内所有知识库。只有工作区所有者才能管理所有知识库。',
|
allKnowledgeDescription: '选择以显示该工作区内所有知识库。只有工作区所有者才能管理所有知识库。',
|
||||||
metadata: {
|
metadata: {
|
||||||
metadata: '元数据',
|
metadata: '元数据',
|
||||||
|
addMetadata: '添加元数据',
|
||||||
createMetadata: {
|
createMetadata: {
|
||||||
title: '新建元数据',
|
title: '新建元数据',
|
||||||
back: '返回',
|
back: '返回',
|
||||||
@ -193,6 +194,12 @@ const translation = {
|
|||||||
builtIn: '内置',
|
builtIn: '内置',
|
||||||
builtInDescription: '内置元数据是系统预定义的元数据,您可以在此处查看和管理内置元数据。',
|
builtInDescription: '内置元数据是系统预定义的元数据,您可以在此处查看和管理内置元数据。',
|
||||||
},
|
},
|
||||||
|
documentMetadata: {
|
||||||
|
metadataToolTip: '元数据是关于文档的数据,用于描述文档的属性。元数据可以帮助您更好地组织和管理文档。',
|
||||||
|
startLabeling: '开始标注',
|
||||||
|
documentInformation: '文档信息',
|
||||||
|
technicalParameters: '技术参数',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user