mirror of https://github.com/langgenius/dify.git
feat: document dataset i18n
This commit is contained in:
parent
e862ab0def
commit
7d5fcfef4c
|
|
@ -4,6 +4,7 @@ import React from 'react'
|
|||
import Button from '../../base/button'
|
||||
import { RiAddLine } from '@remixicon/react'
|
||||
import cn from '@/utils/classnames'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type Props = {
|
||||
className?: string
|
||||
|
|
@ -14,6 +15,7 @@ const AddedMetadataButton: FC<Props> = ({
|
|||
className,
|
||||
onClick,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<Button
|
||||
className={cn('w-full flex items-center', className)}
|
||||
|
|
@ -22,7 +24,7 @@ const AddedMetadataButton: FC<Props> = ({
|
|||
onClick={onClick}
|
||||
>
|
||||
<RiAddLine className='mr-1 size-3.5' />
|
||||
<div>Add metadata</div>
|
||||
<div>{t('dataset.metadata.addMetadata')}</div>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import { RiEditLine } from '@remixicon/react'
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import Divider from '@/app/components/base/divider'
|
||||
|
||||
const i18nPrefix = 'dataset.metadata.documentMetadata'
|
||||
|
||||
const MetadataDocument: FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const [isEdit, setIsEdit] = useState(true)
|
||||
|
|
@ -48,13 +50,13 @@ const MetadataDocument: FC = () => {
|
|||
const documentInfoList = builtList
|
||||
const technicalParams = builtList
|
||||
return (
|
||||
<div className='space-y-4'>
|
||||
{hasData ? (
|
||||
<div className='w-[388px] space-y-4'>
|
||||
{!hasData ? (
|
||||
<div>
|
||||
<InfoGroup
|
||||
title='Metadata'
|
||||
title={t('dataset.metadata.metadata')}
|
||||
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}
|
||||
headerRight={isEdit ? (
|
||||
<div className='flex space-x-1'>
|
||||
|
|
@ -109,12 +111,12 @@ const MetadataDocument: FC = () => {
|
|||
)}
|
||||
|
||||
<InfoGroup
|
||||
title='Document Information'
|
||||
list={builtList}
|
||||
title={t(`${i18nPrefix}.documentInformation`)}
|
||||
list={documentInfoList}
|
||||
/>
|
||||
<InfoGroup
|
||||
title='Technical Parameters'
|
||||
list={builtList}
|
||||
title={t(`${i18nPrefix}.technicalParameters`)}
|
||||
list={technicalParams}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ const NoData: FC<Props> = ({
|
|||
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='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}>
|
||||
<div>Start labeling</div>
|
||||
<div>{t('dataset.metadata.documentMetadata.startLabeling')}</div>
|
||||
<RiArrowRightLine className='ml-1 size-4' />
|
||||
</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ const translation = {
|
|||
allKnowledgeDescription: 'Select to display all knowledge in this workspace. Only the Workspace Owner can manage all knowledge.',
|
||||
metadata: {
|
||||
metadata: 'Metadata',
|
||||
addMetadata: 'Add Metadata',
|
||||
createMetadata: {
|
||||
title: 'New Metadata',
|
||||
back: 'Back',
|
||||
|
|
@ -193,6 +194,12 @@ const translation = {
|
|||
builtIn: 'Built-in',
|
||||
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: '选择以显示该工作区内所有知识库。只有工作区所有者才能管理所有知识库。',
|
||||
metadata: {
|
||||
metadata: '元数据',
|
||||
addMetadata: '添加元数据',
|
||||
createMetadata: {
|
||||
title: '新建元数据',
|
||||
back: '返回',
|
||||
|
|
@ -193,6 +194,12 @@ const translation = {
|
|||
builtIn: '内置',
|
||||
builtInDescription: '内置元数据是系统预定义的元数据,您可以在此处查看和管理内置元数据。',
|
||||
},
|
||||
documentMetadata: {
|
||||
metadataToolTip: '元数据是关于文档的数据,用于描述文档的属性。元数据可以帮助您更好地组织和管理文档。',
|
||||
startLabeling: '开始标注',
|
||||
documentInformation: '文档信息',
|
||||
technicalParameters: '技术参数',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue