add translations for preview components

also fix ellipsis in zh-CN
This commit is contained in:
myl7
2022-02-06 20:34:03 +08:00
parent 04e333aa36
commit 49a601446d
10 changed files with 69 additions and 21 deletions
+7 -4
View File
@@ -3,6 +3,7 @@ import { useRouter } from 'next/router'
import { useClipboard } from 'use-clipboard-copy'
import DPlayer from 'react-dplayer'
import toast from 'react-hot-toast'
import { useTranslation } from 'next-i18next'
import { getBaseUrl } from '../../utils/getBaseUrl'
import { DownloadButton } from '../DownloadBtnGtoup'
@@ -13,6 +14,8 @@ const VideoPreview: React.FC<{ file: OdFileObject }> = ({ file }) => {
const { asPath } = useRouter()
const clipboard = useClipboard()
const { t } = useTranslation()
// OneDrive generates thumbnails for its video files, we pick the thumbnail with the highest resolution
const thumbnail = file.thumbnails && file.thumbnails.length > 0 ? file.thumbnails[0].large.url : ''
@@ -41,7 +44,7 @@ const VideoPreview: React.FC<{ file: OdFileObject }> = ({ file }) => {
<DownloadButton
onClickCallback={() => window.open(file['@microsoft.graph.downloadUrl'])}
btnColor="blue"
btnText="Download"
btnText={t('Download')}
btnIcon="file-download"
/>
{/* <DownloadButton
@@ -49,16 +52,16 @@ const VideoPreview: React.FC<{ file: OdFileObject }> = ({ file }) => {
window.open(`/api/proxy?url=${encodeURIComponent(file['@microsoft.graph.downloadUrl'])}`)
}
btnColor="teal"
btnText="Proxy download"
btnText={t('Proxy download')}
btnIcon="download"
/> */}
<DownloadButton
onClickCallback={() => {
clipboard.copy(`${getBaseUrl()}/api?path=${asPath}&raw=true`)
toast.success('Copied direct link to clipboard.')
toast.success(t('Copied direct link to clipboard.'))
}}
btnColor="pink"
btnText="Copy direct link"
btnText={t('Copy direct link')}
btnIcon="copy"
/>