diff --git a/public/locales/en-US/dashboard.json b/public/locales/en-US/dashboard.json index 3432038..96831b6 100644 --- a/public/locales/en-US/dashboard.json +++ b/public/locales/en-US/dashboard.json @@ -358,6 +358,29 @@ "remoteAddress": "Slave node address", "testCommunicationDes": "After completing the above steps, you can test if the communication is working by clicking the test button below.", "testCommunication": "Test slave communication", - "pathMagicVarDesRemote": "Enter the physical path to the folder you want to store files. Either absolute or relative (relative to slave Cloudreve executable) path is supported. You can use magic variables in the path, which will be automatically replaced with the corresponding values when the file is uploaded; see <0>List of path magic variables for available magic variables." + "pathMagicVarDesRemote": "Enter the physical path to the folder you want to store files. Either absolute or relative (relative to slave Cloudreve executable) path is supported. You can use magic variables in the path, which will be automatically replaced with the corresponding values when the file is uploaded; see <0>List of path magic variables for available magic variables.", + "storageBucket": "Storage bucket", + "editQiniuStoragePolicy": "Edit Qiniu storage policy", + "addQiniuStoragePolicy": "Add Qiniu storage policy", + "qiniuSiteURLDes": "Before using the Qiniu policy, please make sure that the address you entered in Basic Settings - Site Information - Site URL matches the actual address and <0>can be accessed properly by WAN.", + "createQiniuBucket": "Go to <0>Qiniu dashboard to create a storage bucket.。", + "enterQiniuBucket": "Enter the \"bucket name\" you just created:", + "qiniuBucketName": "Bucket name", + "bucketTypeDes": "Select the type of bucket you just created. We recommend selecting \"Private bucket\" for higher security, private bucket does not support \"Get Source Link\" feature.", + "privateBucket": "Private bucket", + "publicBucket": "Public bucket", + "bucketCDNDes": "Fill in the CDN-accelerated domain name you have bound for the storage bucket.", + "bucketCDNDomain": "CDN domain", + "qiniuCredentialDes": "Go to Personal Center - Credential Management in the Qiniu dashboard and fill in the obtained AK, SK.", + "ak": "AK", + "sk": "SK", + "cannotEnableForPrivateBucket": "This feature is not supported under private bucket.", + "limitMimeType": "Do you want to limit MimeTypes of file that can be uploaded?", + "mimeTypeDes": "Enter the MimeType of the allowed files, and separate multiple MimeTypes with a comma. Qiniu will detect the file content to determine the MimeType, and allow the upload if the MimeType is presented in your list.", + "mimeTypeList": "MimeTypes list", + "chunkSizeLabelQiniu": "Specify the chunk size for resumable uploads. Allowed range is 1 MB - 1 GB.", + "createPlaceholderDes": "Do you want to create a placeholder file and deduct user capacity when users start uploading? If enabled, Cloudreve will prevent users from maliciously initiating multiple upload requests but not completing the upload.", + "createPlaceholder": "Create placeholder files", + "notCreatePlaceholder": "Don't create" } } \ No newline at end of file diff --git a/public/locales/zh-CN/dashboard.json b/public/locales/zh-CN/dashboard.json index ab96544..0482f95 100644 --- a/public/locales/zh-CN/dashboard.json +++ b/public/locales/zh-CN/dashboard.json @@ -278,7 +278,7 @@ "policyAdded": "存储策略已添加", "policySaved": "存储策略已保存", "editLocalStoragePolicy": "修改本机存储策略", - "addLocalStoragePolicy": "添加存储策略", + "addLocalStoragePolicy": "添加本机存储策略", "optional": "可选", "pathMagicVarDes": "请在下方输入文件的存储目录路径,可以为绝对路径或相对路径(相对于 Cloudreve)。路径中可以使用魔法变量,文件在上传时会自动替换这些变量为相应值; 可用魔法变量可参考 <0>路径魔法变量列表。", "pathOfFolderToStoreFiles": "存储目录", @@ -357,6 +357,29 @@ "remoteAddress": "从机地址", "testCommunicationDes": "完成以上步骤后,你可以点击下方的测试按钮测试通信是否正常。", "testCommunication": "测试从机通信", - "pathMagicVarDesRemote": "请在下方输入文件的存储目录路径,可以为绝对路径或相对路径(相对于 从机的 Cloudreve)。路径中可以使用魔法变量,文件在上传时会自动替换这些变量为相应值; 可用魔法变量可参考 <0>路径魔法变量列表。" + "pathMagicVarDesRemote": "请在下方输入文件的存储目录路径,可以为绝对路径或相对路径(相对于 从机的 Cloudreve)。路径中可以使用魔法变量,文件在上传时会自动替换这些变量为相应值; 可用魔法变量可参考 <0>路径魔法变量列表。", + "storageBucket": "存储空间", + "editQiniuStoragePolicy": "修改七牛存储策略", + "addQiniuStoragePolicy": "添加七牛存储策略", + "qiniuSiteURLDes": "在使用七牛存储策略前,请确保您在 参数设置 - 站点信息 - 站点URL 中填写的 地址与实际相符,并且 <0>能够被外网正常访问。", + "createQiniuBucket": "前往 <0>七牛控制面板 创建对象存储资源。", + "enterQiniuBucket": "在下方填写您在七牛创建存储空间时指定的“存储空间名称”:", + "qiniuBucketName": "存储空间名称", + "bucketTypeDes": "在下方选择您创建的空间类型,推荐选择“私有空间”以获得更高的安全性,私有空间无法开启“获取直链”功能。", + "privateBucket": "私有", + "publicBucket": "公有", + "bucketCDNDes": "填写您为存储空间绑定的 CDN 加速域名。", + "bucketCDNDomain": "CDN 加速域名", + "qiniuCredentialDes": "在七牛控制面板进入 个人中心 - 密钥管理,在下方填写获得到的 AK、SK。", + "ak": "AK", + "sk": "SK", + "cannotEnableForPrivateBucket": "私有空间无法开启此功能", + "limitMimeType": "是否限制上传文件 MimeType?", + "mimeTypeDes": "输入允许上传的 MimeType,多个请以半角逗号 , 隔开。七牛服务器会侦测文件内容以判断 MimeType,再用判断值跟指定值进行匹配,匹配成功则允许上传。", + "mimeTypeList": "MimeType 列表", + "chunkSizeLabelQiniu": "请指定分片上传时的分片大小,范围 1 MB - 1 GB。", + "createPlaceholderDes": "是否要再用户开始上传时就创建占位符文件并扣除用户容量?开启后,可以防止用户恶意发起多个上传请求但不完成上传。", + "createPlaceholder": "创建占位符文件", + "notCreatePlaceholder": "不创建" } } \ No newline at end of file diff --git a/src/component/Admin/Policy/Guid/QiniuGuide.js b/src/component/Admin/Policy/Guid/QiniuGuide.js index 63d70e9..1e8153e 100644 --- a/src/component/Admin/Policy/Guid/QiniuGuide.js +++ b/src/component/Admin/Policy/Guid/QiniuGuide.js @@ -21,6 +21,8 @@ import { getNumber } from "../../../../utils"; import DomainInput from "../../Common/DomainInput"; import SizeInput from "../../Common/SizeInput"; import MagicVar from "../../Dialogs/MagicVar"; +import { Trans, useTranslation } from "react-i18next"; + const useStyles = makeStyles((theme) => ({ stepContent: { @@ -68,28 +70,29 @@ const useStyles = makeStyles((theme) => ({ const steps = [ { - title: "存储空间", + title: "storageBucket", optional: false, }, { - title: "上传路径", + title: "storagePathStep", optional: false, }, { - title: "直链设置", + title: "sourceLinkStep", optional: false, }, { - title: "上传设置", + title: "uploadSettingStep", optional: false, }, { - title: "完成", + title: "finishStep", optional: false, }, ]; export default function RemoteGuide(props) { + const { t } = useTranslation("dashboard", { keyPrefix: "policy" }); const classes = useStyles(); const history = useHistory(); @@ -185,7 +188,7 @@ export default function RemoteGuide(props) { ToggleSnackbar( "top", "right", - "存储策略已" + (props.policy ? "保存" : "添加"), + props.policy ? t("policySaved") : t("policyAdded"), "success" ); setActiveStep(5); @@ -203,7 +206,9 @@ export default function RemoteGuide(props) { return (
- {props.policy ? "修改" : "添加"} 七牛 存储策略 + {props.policy + ? t("editQiniuStoragePolicy") + : t("addQiniuStoragePolicy")} {steps.map((label, index) => { @@ -211,7 +216,10 @@ export default function RemoteGuide(props) { const labelProps = {}; if (label.optional) { labelProps.optional = ( - 可选 + + {" "} + {t("optional")} + ); } if (isStepSkipped(index)) { @@ -219,7 +227,9 @@ export default function RemoteGuide(props) { } return ( - {label.title} + + {t(label.title)} + ); })} @@ -239,9 +249,11 @@ export default function RemoteGuide(props) {
- 在使用七牛存储策略前,请确保您在 参数设置 - - 站点信息 - 站点URL 中填写的 地址与实际相符,并且 - 能够被外网正常访问。 + ]} + />
@@ -252,14 +264,19 @@ export default function RemoteGuide(props) {
- 前往 - - 七牛控制面板 - - 创建对象存储资源。 + , + ]} + />
@@ -270,12 +287,12 @@ export default function RemoteGuide(props) {
- 在下方填写您在七牛创建存储空间时指定的“存储空间名称”: + {t("enterQiniuBucket")}
- 存储空间名称 + {t("qiniuBucketName")}
- 在下方选择您创建的空间类型,推荐选择“私有空间”以获得更高的安全性,私有空间无法开启“获取直链”功能。 + {t("bucketTypeDes")}
@@ -308,14 +325,14 @@ export default function RemoteGuide(props) { control={ } - label="私有" + label={t("privateBucket")} /> } - label="公有" + label={t("publicBucket")} /> @@ -329,14 +346,14 @@ export default function RemoteGuide(props) {
- 填写您为存储空间绑定的 CDN 加速域名。 + {t("bucketCDNDes")}
@@ -348,13 +365,12 @@ export default function RemoteGuide(props) {
- 在七牛控制面板进入 个人中心 - - 密钥管理,在下方填写获得到的 AK、SK。 + {t("qiniuCredentialDes")}
- AK + {t("ak")} - SK + {t("sk")} - 下一步 + {t("next")}
@@ -405,25 +421,23 @@ export default function RemoteGuide(props) {
- 请在下方输入文件的存储目录路径,可以为绝对路径或相对路径(相对于 - 从机的 - Cloudreve)。路径中可以使用魔法变量,文件在上传时会自动替换这些变量为相应值; - 可用魔法变量可参考{" "} - { - e.preventDefault(); - setMagicVar("path"); - }} - > - 路径魔法变量列表 - {" "} - 。 + setMagicVar("path")} + />, + ]} + />
- 存储目录 + {t("pathOfFolderToStoreFiles")}
- 是否需要对存储的物理文件进行重命名?此处的重命名不会影响最终呈现给用户的 - 文件名。文件名也可使用魔法变量, - 可用魔法变量可参考{" "} - { - e.preventDefault(); - setMagicVar("file"); - }} - > - 文件名魔法变量列表 - {" "} - 。 + setMagicVar("file")} + />, + ]} + />
@@ -469,14 +482,14 @@ export default function RemoteGuide(props) { control={ } - label="开启重命名" + label={t("autoRenameStoredFile")} /> } - label="不开启" + label={t("keepOriginalFileName")} /> @@ -486,7 +499,7 @@ export default function RemoteGuide(props) {
- 命名规则 + {t("renameRule")} setActiveStep(0)} > - 上一步 + {t("back")}
@@ -537,9 +550,9 @@ export default function RemoteGuide(props) {
- 是否允许获取文件永久直链? + {t("enableGettingPermanentSourceLink")}
- 开启后,用户可以请求获得能直接访问到文件内容的直链,适用于图床应用或自用。 + {t("enableGettingPermanentSourceLinkDes")}
@@ -555,7 +568,9 @@ export default function RemoteGuide(props) { ToggleSnackbar( "top", "right", - "私有空间无法开启此功能", + t( + "cannotEnableForPrivateBucket" + ), "warning" ); return; @@ -571,14 +586,14 @@ export default function RemoteGuide(props) { control={ } - label="允许" + label={t("allowed")} /> } - label="禁止" + label={t("forbidden")} /> @@ -592,7 +607,7 @@ export default function RemoteGuide(props) { className={classes.button} onClick={() => setActiveStep(1)} > - 上一步 + {t("back")} {" "}
@@ -620,7 +635,7 @@ export default function RemoteGuide(props) {
- 是否限制上传的单文件大小? + {t("limitFileSize")}
@@ -652,14 +667,14 @@ export default function RemoteGuide(props) { control={ } - label="限制" + label={t("limit")} /> } - label="不限制" + label={t("notLimit")} /> @@ -674,7 +689,7 @@ export default function RemoteGuide(props) {
- 输入限制: + {t("enterSizeLimit")}
- 是否限制上传文件扩展名? + {t("limitFileExt")}
@@ -737,14 +752,14 @@ export default function RemoteGuide(props) { control={ } - label="限制" + label={t("limit")} /> } - label="不限制" + label={t("notLimit")} /> @@ -761,13 +776,12 @@ export default function RemoteGuide(props) {
- 输入允许上传的文件扩展名,多个请以半角逗号 , - 隔开 + {t("enterFileExt")}
- 扩展名列表 + {t("extList")}
- 是否限制上传文件 MimeType? + {t("limitMimeType")}
@@ -834,14 +848,14 @@ export default function RemoteGuide(props) { control={ } - label="限制" + label={t("limit")} /> } - label="不限制" + label={t("notLimit")} /> @@ -862,14 +876,12 @@ export default function RemoteGuide(props) {
- 输入允许上传的 MimeType,多个请以半角逗号 , - 隔开。七牛服务器会侦测文件内容以判断 - MimeType,再用判断值跟指定值进行匹配,匹配成功则允许上传 + {t("mimeTypeDes")}
- MimeType 列表 + {t("mimeTypeList")}
- 请指定分片上传时的分片大小,范围 1 MB - 1 GB。 + {t("chunkSizeLabelQiniu")}
- 启用分片上传后,用户上传的文件将会被切分成分片逐个上传到存储端,当上传中断后,用户可以选择从上次上传的分片后继续开始上传。 + {t("chunkSizeDes")}
@@ -926,7 +938,7 @@ export default function RemoteGuide(props) {
- 是否要再用户开始上传时就创建占位符文件并扣除用户容量?开启后,可以防止用户恶意发起多个上传请求但不完成上传。 + {t("createPlaceholderDes")}
@@ -947,14 +959,14 @@ export default function RemoteGuide(props) { control={ } - label="创建占位符文件" + label={t("createPlaceholder")} /> } - label="不创建" + label={t("notCreatePlaceholder")} /> @@ -968,7 +980,7 @@ export default function RemoteGuide(props) { className={classes.button} onClick={() => setActiveStep(2)} > - 上一步 + {t("back")} {" "}
@@ -985,15 +997,15 @@ export default function RemoteGuide(props) { {activeStep === 4 && (
-
+
- 最后一步,为此存储策略命名: + {t("nameThePolicy")}
- 存储策略名 + {t("policyName")} setActiveStep(3)} > - 上一步 + {t("back")} {" "}
@@ -1028,10 +1040,10 @@ export default function RemoteGuide(props) { <>
- 存储策略已{props.policy ? "保存" : "添加"}! + {props.policy ? t("policySaved") : t("policyAdded")} - 要使用此存储策略,请到用户组管理页面,为相应用户组绑定此存储策略。 + {t("furtherActions")}
@@ -1040,7 +1052,7 @@ export default function RemoteGuide(props) { className={classes.button} onClick={() => history.push("/admin/policy")} > - 返回存储策略列表 + {t("backToList")}