file-uploader i18n

This commit is contained in:
StyleZhang 2024-08-06 18:03:20 +08:00
parent 38e6e40900
commit 251ab5418f
4 changed files with 16 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import {
memo, memo,
useState, useState,
} from 'react' } from 'react'
import { useTranslation } from 'react-i18next'
import { RiUploadCloud2Line } from '@remixicon/react' import { RiUploadCloud2Line } from '@remixicon/react'
import { import {
PortalToFollowElem, PortalToFollowElem,
@ -22,6 +23,7 @@ const FileFromLinkOrLocal = ({
showFromLocal = true, showFromLocal = true,
trigger, trigger,
}: FileFromLinkOrLocalProps) => { }: FileFromLinkOrLocalProps) => {
const { t } = useTranslation()
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const [url, setUrl] = useState('') const [url, setUrl] = useState('')
@ -53,7 +55,7 @@ const FileFromLinkOrLocal = ({
disabled={!url} disabled={!url}
onClick={() => onLink?.(url)} onClick={() => onLink?.(url)}
> >
OK {t('common.operation.ok')}
</Button> </Button>
</div> </div>
) )
@ -74,7 +76,7 @@ const FileFromLinkOrLocal = ({
variant='secondary-accent' variant='secondary-accent'
> >
<RiUploadCloud2Line className='mr-1 w-4 h-4' /> <RiUploadCloud2Line className='mr-1 w-4 h-4' />
Upload from computer {t('common.fileUploader.uploadFromComputer')}
</Button> </Button>
) )
} }

View File

@ -6,6 +6,7 @@ import {
RiLink, RiLink,
RiUploadCloud2Line, RiUploadCloud2Line,
} from '@remixicon/react' } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import FileFromLinkOrLocal from '../file-from-link-or-local' import FileFromLinkOrLocal from '../file-from-link-or-local'
import FileInAttachmentItem from './file-in-attachment-item' import FileInAttachmentItem from './file-in-attachment-item'
import Button from '@/app/components/base/button' import Button from '@/app/components/base/button'
@ -17,15 +18,16 @@ type Option = {
icon: JSX.Element icon: JSX.Element
} }
const FileUploaderInAttachment = () => { const FileUploaderInAttachment = () => {
const { t } = useTranslation()
const options = [ const options = [
{ {
value: 'local', value: 'local',
label: 'Local upload', label: t('common.fileUploader.uploadFromComputer'),
icon: <RiUploadCloud2Line className='w-4 h-4' />, icon: <RiUploadCloud2Line className='w-4 h-4' />,
}, },
{ {
value: 'link', value: 'link',
label: 'Paste file link', label: t('common.fileUploader.pasteFileLink'),
icon: <RiLink className='w-4 h-4' />, icon: <RiLink className='w-4 h-4' />,
}, },
] ]

View File

@ -552,6 +552,10 @@ const translation = {
pasteImageLinkInvalid: 'Invalid image link', pasteImageLinkInvalid: 'Invalid image link',
imageUpload: 'Image Upload', imageUpload: 'Image Upload',
}, },
fileUploader: {
uploadFromComputer: 'Local upload',
pasteImageLink: 'Paste file link',
},
tag: { tag: {
placeholder: 'All Tags', placeholder: 'All Tags',
addNew: 'Add new tag', addNew: 'Add new tag',

View File

@ -548,6 +548,10 @@ const translation = {
pasteImageLinkInvalid: '图片链接无效', pasteImageLinkInvalid: '图片链接无效',
imageUpload: '图片上传', imageUpload: '图片上传',
}, },
fileUploader: {
uploadFromComputer: '从本地上传',
pasteFileLink: '粘贴文件链接',
},
tag: { tag: {
placeholder: '全部标签', placeholder: '全部标签',
addNew: '创建新标签', addNew: '创建新标签',