From a14cee53b2d2ee92894d113ae0b9f7fd8b843055 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Tue, 7 Jun 2022 17:44:05 +0800 Subject: [PATCH] i18n: transportation settings --- public/locales/en-US/dashboard.json | 43 ++++++- public/locales/zh-CN/dashboard.json | 43 ++++++- src/component/Admin/Setting/UploadDownload.js | 105 ++++++++---------- src/component/Download/FinishedCard.js | 4 +- 4 files changed, 135 insertions(+), 60 deletions(-) diff --git a/public/locales/en-US/dashboard.json b/public/locales/en-US/dashboard.json index af541e8..4b357ed 100644 --- a/public/locales/en-US/dashboard.json +++ b/public/locales/en-US/dashboard.json @@ -118,6 +118,47 @@ "activateNewUserDes": "Template for activation email after new user registration.", "resetPassword": "Reset password", "resetPasswordDes": "Template reset password.", - "sendTestEmail": "Send test email" + "sendTestEmail": "Send test email", + "transportation": "Transportation", + "workerNum": "Number of worker", + "workerNumDes": "The maximum number of tasks to be executed in parallel by the master node task queue, restarting Cloudreve is needed to take effect.", + "transitParallelNum": "Number of transfer in parallel", + "transitParallelNumDes": "Maximum number of parallel co-processes for transfer tasks.", + "tempFolder": "Temp folder", + "tempFolderDes": "Used to store temporary files generated by tasks such as decompression, compression, etc.", + "textEditMaxSize": "Max size of editable text files", + "textEditMaxSizeDes": "The maximum size of a text file that can be edited online, files beyond this size cannot be edited online.", + "failedChunkRetry": "Max chunk error retries", + "failedChunkRetryDes": "Maximum number of retries after a failed chunk, only for server-side uploads or transferring.", + "cacheChunks": "Cache chunk for retries", + "cacheChunksDes": "If enabled, streaming chunk uploads will cache chunk data in a temporary directory for retrying after failed uploads.\n If disabled, streaming chunk uploads do not take up additional hard disk space, but the entire upload will fail immediately after a single chunk failure.", + "resetConnection": "Reset connection after failed upload", + "resetConnectionDes": "If enabled, the server will force to reset the connection if upload verification fails.", + "expirationDuration": "Expire durations (seconds)", + "batchDownload": "Batch download", + "downloadSession": "Download session", + "previewURL": "Preview URL", + "docPreviewURL": "Doc preview URL", + "uploadSession": "Upload session", + "uploadSessionDes": "For supported storage policy, user can resume uploads within upload session expiration. Max value various from third-party storage providers.", + "downloadSessionForShared": "Download session in shares", + "downloadSessionForSharedDes": "Repeated downloads of shared files within this set period of time will not be counted in the total number of downloads.", + "onedriveMonitorInterval": "OneDrive upload monitor interval", + "onedriveMonitorIntervalDes": "At set intervals, Cloudreve will request OneDrive to check client uploads to ensure they're under control.", + "onedriveCallbackTolerance": "OneDrive callback timeout", + "onedriveCallbackToleranceDes": "Maximum time to wait for the callback after the OneDrive client has finished uploading, if it exceeds it, the upload will be considered failed.", + "onedriveDownloadURLCache": "OneDrive download cache", + "onedriveDownloadURLCacheDes": "Cloudreve can cache the result after getting the file download URL to reduce the frequency of hot API requests.", + "slaveAPIExpiration": "Slave API timeout (seconds)", + "slaveAPIExpirationDes": "Timeout time for master to wait for slave API request responses.", + "heartbeatInterval": "Node heartbeat interval (seconds)", + "heartbeatIntervalDes": "The interval at which the master node sends heartbeats to slave nodes.", + "heartbeatFailThreshold": "Heartbeat failure retry threshold", + "heartbeatFailThresholdDes": "The maximum number of retries the master can make after sending a heartbeat to a slave that fails. After all failed retries, the node will enter recovery mode.", + "heartbeatRecoverModeInterval": "Recover mode heartbeat interval (seconds)", + "heartbeatRecoverModeIntervalDes": "Interval between master attempts to reconnect to a node after the node has been marked as recovery mode.", + "slaveTransitExpiration": "Slave transfer timeout (seconds)", + "slaveTransitExpirationDes": "Maximum time that can be consumed by a slave to execute a file transfer task.", + "nodesCommunication": "Node communication" } } \ No newline at end of file diff --git a/public/locales/zh-CN/dashboard.json b/public/locales/zh-CN/dashboard.json index 85969e9..9a3a51c 100644 --- a/public/locales/zh-CN/dashboard.json +++ b/public/locales/zh-CN/dashboard.json @@ -118,6 +118,47 @@ "activateNewUserDes": "新用户注册后激活邮件的模板", "resetPassword": "重置密码", "resetPasswordDes": "密码重置邮件模板", - "sendTestEmail": "发送测试邮件" + "sendTestEmail": "发送测试邮件", + "transportation": "传输", + "workerNum": "Worker 数量", + "workerNumDes": "主机节点任务队列最多并行执行的任务数,保存后需要重启 Cloudreve 生效", + "transitParallelNum": "中转并行传输", + "transitParallelNumDes": "任务队列中转任务传输时,最大并行协程数", + "tempFolder": "临时目录", + "tempFolderDes": "用于存放解压缩、压缩等任务产生的临时文件的目录路径", + "textEditMaxSize": "文本文件在线编辑大小", + "textEditMaxSizeDes": "文本文件可在线编辑的最大大小,超出此大小的文件无法在线编辑", + "failedChunkRetry": "分片错误重试", + "failedChunkRetryDes": "分片上传失败后重试的最大次数,只适用于服务端上传或中转", + "cacheChunks": "缓存流式分片文件以用于重试", + "cacheChunksDes": "开启后,流式中转分片上传时会将分片数据缓存在系统临时目录,以便用于分片上传失败后的重试;\n 关闭后,流式中转分片上传不会额外占用硬盘空间,但分片上传失败后整个上传会立即失败。", + "resetConnection": "上传校验失败时强制重置连接", + "resetConnectionDes": "开启后,如果本次策略、头像等数据上传校验失败,服务器会强制重置连接", + "expirationDuration": "有效期 (秒)", + "batchDownload": "打包下载", + "downloadSession": "下载会话", + "previewURL": "预览链接", + "docPreviewURL": "Office 文档预览链接", + "uploadSession": "上传会话", + "uploadSessionDes": "在上传会话有效期内,对于支持的存储策略,用户可以断点续传未完成的任务。最大可设定的值受限于不同存储策略服务商的规则。", + "downloadSessionForShared": "分享下载会话", + "downloadSessionForSharedDes": "设定时间内重复下载分享文件,不会被记入总下载次数", + "onedriveMonitorInterval": "OneDrive 客户端上传监控间隔", + "onedriveMonitorIntervalDes": "每间隔所设定时间,Cloudreve 会向 OneDrive 请求检查客户端上传情况已确保客户端上传可控", + "onedriveCallbackTolerance": "OneDrive 回调等待", + "onedriveCallbackToleranceDes": "OneDrive 客户端上传完成后,等待回调的最大时间,如果超出会被认为上传失败", + "onedriveDownloadURLCache": "OneDrive 下载请求缓存", + "onedriveDownloadURLCacheDes": "OneDrive 获取文件下载 URL 后可将结果缓存,减轻热门文件下载API请求频率", + "slaveAPIExpiration": "从机API请求超时(秒)", + "slaveAPIExpirationDes": "主机等待从机API请求响应的超时时间", + "heartbeatInterval": "节点心跳间隔(秒)", + "heartbeatIntervalDes": "主机节点向从机节点发送心跳的间隔", + "heartbeatFailThreshold": "心跳失败重试阈值", + "heartbeatFailThresholdDes": "主机向从机发送心跳失败后,主机可最大重试的次数。重试失败后,节点会进入恢复模式", + "heartbeatRecoverModeInterval": "恢复模式心跳间隔(秒)", + "heartbeatRecoverModeIntervalDes": "节点因异常被主机标记为恢复模式后,主机尝试重新连接节点的间隔", + "slaveTransitExpiration": "从机中转超时(秒)", + "slaveTransitExpirationDes": "从机执行文件中转任务可消耗的最长时间", + "nodesCommunication": "节点通信" } } \ No newline at end of file diff --git a/src/component/Admin/Setting/UploadDownload.js b/src/component/Admin/Setting/UploadDownload.js index c5a950d..afdfb0e 100644 --- a/src/component/Admin/Setting/UploadDownload.js +++ b/src/component/Admin/Setting/UploadDownload.js @@ -12,6 +12,7 @@ import { useDispatch } from "react-redux"; import { toggleSnackbar } from "../../../redux/explorer"; import API from "../../../middleware/Api"; import SizeInput from "../Common/SizeInput"; +import { useTranslation } from "react-i18next"; const useStyles = makeStyles((theme) => ({ root: { @@ -33,6 +34,7 @@ const useStyles = makeStyles((theme) => ({ })); export default function UploadDownload() { + const { t } = useTranslation("dashboard", { keyPrefix: "settings" }); const classes = useStyles(); const [loading, setLoading] = useState(false); const [options, setOptions] = useState({ @@ -109,7 +111,7 @@ export default function UploadDownload() { options: option, }) .then(() => { - ToggleSnackbar("top", "right", "设置已更改", "success"); + ToggleSnackbar("top", "right", t("saved"), "success"); }) .catch((error) => { ToggleSnackbar("top", "right", error.message, "error"); @@ -124,13 +126,13 @@ export default function UploadDownload() {
- 存储与传输 + {t("transportation")}
- Worker 数量 + {t("workerNum")} - 主机节点任务队列最多并行执行的任务数,保存后需要重启 - Cloudreve 生效 + {t("workerNumDes")}
@@ -152,7 +153,7 @@ export default function UploadDownload() {
- 中转并行传输 + {t("transitParallelNum")} - 任务队列中转任务传输时,最大并行协程数 + {t("transitParallelNumDes")}
@@ -175,7 +176,7 @@ export default function UploadDownload() {
- 临时目录 + {t("tempFolder")} - 用于存放解压缩、压缩等任务产生的临时文件的目录路径 + {t("tempFolderDes")}
@@ -197,12 +198,12 @@ export default function UploadDownload() { required min={0} max={2147483647} - label={"文本文件在线编辑大小"} + label={t("textEditMaxSize")} /> )} - 文本文件可在线编辑的最大大小,超出此大小的文件无法在线编辑 + {t("textEditMaxSizeDes")}
@@ -210,7 +211,7 @@ export default function UploadDownload() {
- 分片错误重试 + {t("failedChunkRetry")} - 分片上传失败后重试的最大次数,只适用于服务端上传或中转 + {t("failedChunkRetryDes")}
@@ -242,11 +243,10 @@ export default function UploadDownload() { )} /> } - label="缓存流式分片文件以用于重试" + label={t("cacheChunks")} /> - 开启后,流式中转分片上传时会将分片数据缓存在系统临时目录,以便用于分片上传失败后的重试; - 关闭后,流式中转分片上传不会额外占用硬盘空间,但分片上传失败后整个上传会立即失败。 + {t("cacheChunksDes")}
@@ -265,10 +265,10 @@ export default function UploadDownload() { )} /> } - label="上传校验失败时强制重置连接" + label={t("resetConnection")} /> - 开启后,如果本次策略、头像等数据上传校验失败,服务器会强制重置连接 + {t("resetConnectionDes")} @@ -277,61 +277,56 @@ export default function UploadDownload() {
- 有效期 (秒) + {t("expirationDuration")}
{[ { - name: "打包下载", + name: "batchDownload", field: "archive_timeout", }, { - name: "下载会话", + name: "downloadSession", field: "download_timeout", }, { - name: "预览链接", + name: "previewURL", field: "preview_timeout", }, { - name: "Office 文档预览连接", + name: "docPreviewURL", field: "doc_preview_timeout", }, { - name: "上传会话", + name: "uploadSession", field: "upload_session_timeout", - des: - "在上传会话有效期内,对于支持的存储策略,用户可以断点续传未完成的任务。最大可设定的值受限于不同存储策略服务商的规则。", + des: "uploadSessionDes", }, { - name: "分享下载会话", + name: "downloadSessionForShared", field: "share_download_session_timeout", - des: - "设定时间内重复下载分享文件,不会被记入总下载次数", + des: "downloadSessionForSharedDes", }, { - name: "OneDrive 客户端上传监控间隔", + name: "onedriveMonitorInterval", field: "onedrive_monitor_timeout", - des: - "每间隔所设定时间,Cloudreve 会向 OneDrive 请求检查客户端上传情况已确保客户端上传可控", + des: "onedriveMonitorIntervalDes", }, { - name: "OneDrive 回调等待", + name: "onedriveCallbackTolerance", field: "onedrive_callback_check", - des: - "OneDrive 客户端上传完成后,等待回调的最大时间,如果超出会被认为上传失败", + des: "onedriveCallbackToleranceDes", }, { - name: "OneDrive 下载请求缓存", + name: "onedriveDownloadURLCache", field: "onedrive_source_timeout", - des: - "OneDrive 获取文件下载 URL 后可将结果缓存,减轻热门文件下载API请求频率", + des: "onedriveDownloadURLCacheDes", }, ].map((input) => (
- {input.name} + {t(input.name)} {input.des && ( - {input.des} + {t(input.des)} )} @@ -356,42 +351,40 @@ export default function UploadDownload() {
- 节点通信 + {t("nodesCommunication")}
{[ { - name: "从机API请求超时(秒)", + name: "slaveAPIExpiration", field: "slave_api_timeout", - des: "主机等待从机API请求响应的超时时间", + des: "slaveAPIExpirationDes", }, { - name: "节点心跳间隔(秒)", + name: "heartbeatInterval", field: "slave_ping_interval", - des: "主机节点向从机节点发送心跳的间隔", + des: "heartbeatIntervalDes", }, { - name: "心跳失败重试阈值", + name: "heartbeatFailThreshold", field: "slave_node_retry", - des: - "主机向从机发送心跳失败后,主机可最大重试的次数。重试失败后,节点会进入恢复模式", + des: "heartbeatFailThresholdDes", }, { - name: "恢复模式心跳间隔(秒)", + name: "heartbeatRecoverModeInterval", field: "slave_recover_interval", - des: - "节点因异常被主机标记为恢复模式后,主机尝试重新连接节点的间隔", + des: "heartbeatRecoverModeIntervalDes", }, { - name: "从机中转超时(秒)", + name: "slaveTransitExpiration", field: "slave_transfer_timeout", - des: "从机执行文件中转任务可消耗的最长时间", + des: "slaveTransitExpirationDes", }, ].map((input) => (
- {input.name} + {t(input.name)} - {input.des} + {t(input.des)}
@@ -419,7 +412,7 @@ export default function UploadDownload() { variant={"contained"} color={"primary"} > - 保存 + {t("save")}
diff --git a/src/component/Download/FinishedCard.js b/src/component/Download/FinishedCard.js index 4c3a5ec..2305391 100644 --- a/src/component/Download/FinishedCard.js +++ b/src/component/Download/FinishedCard.js @@ -287,7 +287,7 @@ export default function FinishedCard(props) { }} noWrap > - {"transferring"} + {t("transferring")} )} {props.task.status === 4 && @@ -299,7 +299,7 @@ export default function FinishedCard(props) { }} noWrap > - {"transferring"} + {t("transferring")} )} {props.task.status === 4 &&