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

View File

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

View File

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

View File

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