feat(i18n): add download success and failure messages in multiple languages

This commit is contained in:
kangfenmao 2025-05-10 10:17:44 +08:00
parent 42733d0fc8
commit 7310eebebc
6 changed files with 42 additions and 29 deletions

View File

@ -620,7 +620,9 @@
"error.siyuan.no_config": "Siyuan Note API address or token is not configured",
"success.siyuan.export": "Successfully exported to Siyuan Note",
"warn.yuque.exporting": "Exporting to Yuque, please do not request export repeatedly!",
"warn.siyuan.exporting": "Exporting to Siyuan Note, please do not request export repeatedly!"
"warn.siyuan.exporting": "Exporting to Siyuan Note, please do not request export repeatedly!",
"download.success": "Download successfully",
"download.failed": "Download failed"
},
"minapp": {
"popup": {

View File

@ -620,7 +620,9 @@
"success.siyuan.export": "思源ノートへのエクスポートに成功しました",
"warn.yuque.exporting": "語雀にエクスポート中です。重複してエクスポートしないでください!",
"warn.siyuan.exporting": "思源ノートにエクスポート中です。重複してエクスポートしないでください!",
"error.yuque.no_config": "語雀のAPIアドレスまたはトークンが設定されていません"
"error.yuque.no_config": "語雀のAPIアドレスまたはトークンが設定されていません",
"download.success": "ダウンロードに成功しました",
"download.failed": "ダウンロードに失敗しました"
},
"minapp": {
"popup": {

View File

@ -620,7 +620,9 @@
"error.siyuan.no_config": "Не настроен API адрес или токен Siyuan",
"success.siyuan.export": "Успешный экспорт в Siyuan",
"warn.yuque.exporting": "Экспортируется в Yuque, пожалуйста, не отправляйте повторные запросы!",
"warn.siyuan.exporting": "Экспортируется в Siyuan, пожалуйста, не отправляйте повторные запросы!"
"warn.siyuan.exporting": "Экспортируется в Siyuan, пожалуйста, не отправляйте повторные запросы!",
"download.success": "Скачано успешно",
"download.failed": "Скачивание не удалось"
},
"minapp": {
"popup": {

View File

@ -620,7 +620,9 @@
"error.siyuan.no_config": "未配置思源笔记API地址或令牌",
"success.siyuan.export": "导出到思源笔记成功",
"warn.yuque.exporting": "正在导出语雀, 请勿重复请求导出!",
"warn.siyuan.exporting": "正在导出到思源笔记,请勿重复请求导出!"
"warn.siyuan.exporting": "正在导出到思源笔记,请勿重复请求导出!",
"download.success": "下载成功",
"download.failed": "下载失败"
},
"minapp": {
"popup": {

View File

@ -620,7 +620,9 @@
"error.siyuan.no_config": "未配置思源筆記API地址或令牌",
"success.siyuan.export": "導出到思源筆記成功",
"warn.yuque.exporting": "正在導出語雀,請勿重複請求導出!",
"warn.siyuan.exporting": "正在導出到思源筆記,請勿重複請求導出!"
"warn.siyuan.exporting": "正在導出到思源筆記,請勿重複請求導出!",
"download.success": "下載成功",
"download.failed": "下載失敗"
},
"minapp": {
"popup": {

View File

@ -13,6 +13,7 @@ import { Image as AntdImage, Space } from 'antd'
import { FC } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
interface Props {
block: ImageMessageBlock
}
@ -87,40 +88,42 @@ const MessageImage: FC<Props> = ({ block }) => {
}
}
const renderToolbar =
(currentImage: string, currentIndex: number) =>
(
_: any,
{
transform: { scale },
actions: { onFlipY, onFlipX, onRotateLeft, onRotateRight, onZoomOut, onZoomIn, onReset }
}: any
) => (
<ToobarWrapper size={12} className="toolbar-wrapper">
<SwapOutlined rotate={90} onClick={onFlipY} />
<SwapOutlined onClick={onFlipX} />
<RotateLeftOutlined onClick={onRotateLeft} />
<RotateRightOutlined onClick={onRotateRight} />
<ZoomOutOutlined disabled={scale === 1} onClick={onZoomOut} />
<ZoomInOutlined disabled={scale === 50} onClick={onZoomIn} />
<UndoOutlined onClick={onReset} />
<CopyOutlined onClick={() => onCopy(block.metadata?.generateImageResponse?.type!, currentImage)} />
<DownloadOutlined onClick={() => onDownload(currentImage, currentIndex)} />
</ToobarWrapper>
)
const images = block.metadata?.generateImageResponse?.images?.length
? block.metadata?.generateImageResponse?.images
: // TODO 加file是否合适
block?.file?.path
: block?.file?.path
? [`file://${block?.file?.path}`]
: []
return (
<Container style={{ marginBottom: 8 }}>
{images.map((image, index) => (
<Image
src={image}
key={`image-${index}`}
height={300}
preview={{
toolbarRender: (
_,
{
transform: { scale },
actions: { onFlipY, onFlipX, onRotateLeft, onRotateRight, onZoomOut, onZoomIn, onReset }
}
) => (
<ToobarWrapper size={12} className="toolbar-wrapper">
<SwapOutlined rotate={90} onClick={onFlipY} />
<SwapOutlined onClick={onFlipX} />
<RotateLeftOutlined onClick={onRotateLeft} />
<RotateRightOutlined onClick={onRotateRight} />
<ZoomOutOutlined disabled={scale === 1} onClick={onZoomOut} />
<ZoomInOutlined disabled={scale === 50} onClick={onZoomIn} />
<UndoOutlined onClick={onReset} />
<CopyOutlined onClick={() => onCopy(block.metadata?.generateImageResponse?.type!, image)} />
<DownloadOutlined onClick={() => onDownload(image, index)} />
</ToobarWrapper>
)
}}
style={{ maxWidth: 500, maxHeight: 500 }}
preview={{ toolbarRender: renderToolbar(image, index) }}
/>
))}
</Container>