From a8fd669d84f1cb9e5cb59cf24586844f289a86e8 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Thu, 7 Jul 2022 20:07:20 +0800 Subject: [PATCH] i18n: edit policy in pro mode --- public/locales/en-US/dashboard.json | 49 ++++++- public/locales/zh-CN/dashboard.json | 49 ++++++- src/component/Admin/Policy/Guid/EditPro.js | 154 +++++++++------------ 3 files changed, 165 insertions(+), 87 deletions(-) diff --git a/public/locales/en-US/dashboard.json b/public/locales/en-US/dashboard.json index 2d0ce95..07b4c0e 100644 --- a/public/locales/en-US/dashboard.json +++ b/public/locales/en-US/dashboard.json @@ -489,6 +489,53 @@ "selectRegionDes": "Select the region where the storage bucket is located or enter the region code manually.", "enterAccessCredentials": "Obtain a pair of access credential and fill in below:", "accessKey": "AccessKey", - "chunkSizeLabelS3": "Specify the chunk size for resumable uploads. Allowed range is 5 MB - 5 GB." + "chunkSizeLabelS3": "Specify the chunk size for resumable uploads. Allowed range is 5 MB - 5 GB.", + "editPolicy": "Edit storage policy", + "setting":"Setting name", + "value": "Value", + "description": "Description", + "id": "ID", + "policyID": "ID of storage policy.", + "policyType": "Type of storage policy.", + "server": "Server", + "policyEndpoint": "Storage node endpoint.", + "bucketID": "Identifier of storage bucket.", + "yes": "Yes", + "no": "No", + "privateBucketDes": "Whether the storage bucket is private.", + "resourceRootURL": "File resource root URL", + "resourceRootURLDes": "Prefix of URL generated for previewing and downloading.", + "akDes": "AccessKey / RefreshToken", + "maxSizeBytes": "Max single file size (Bytes)", + "maxSizeBytesDes": "Max file size can be uploaded, 0 means no limit.", + "autoRename": "Auto rename", + "autoRenameDes": "Whether to automatically rename files.", + "storagePath": "Storage path", + "storagePathDes": "Physical path of uploaded files.", + "fileName": "File name", + "fileNameDes": "Physical name of uploaded files.", + "allowGetSourceLink": "Allow getting source link", + "allowGetSourceLinkDes": "Whether to allow getting source links. Note that some storage policy types are not supported, and even if they are turned on here, the obtained source links will be invalid.", + "upyunToken": "Upyun anti-hotlinking token", + "upyunOnly": "Available only for Upyun policy.", + "allowedFileExtension": "Allowed file extensions", + "emptyIsNoLimit": "Blank means not limit.", + "allowedMimetype": "Allowed MimeType", + "qiniuOnly": "Available only for Qiniu policy.", + "odRedirectURL": "OneDrive redirect URL", + "noModificationNeeded": "Generally no modification is needed.", + "odReverseProxy": "OneDrive reverse proxy server", + "odOnly": "Available only for OneDrive policy.", + "odDriverID": "OneDrive/SharePoint driver ID", + "odDriverIDDes": "Available only for OneDrive policy, blank means use default OneDrive driver.", + "s3Region": "Amazon S3 Region", + "s3Only": "Available only for AWS S3 policy.", + "lanEndpoint": "Intranet EndPoint.", + "ossOnly": "Available only for OSS policy.", + "chunkSizeBytes": "Chunk size (Bytes)", + "chunkSizeBytesDes": "Size of chunk for resumable uploads. Only supported in partial storage policy.", + "placeHolderWithSize": "Use placeholder before uploading", + "placeHolderWithSizeDes": "Whether to create a placeholder file before uploading .Only supported in partial storage policy.", + "saveChanges": "Save changes" } } \ No newline at end of file diff --git a/public/locales/zh-CN/dashboard.json b/public/locales/zh-CN/dashboard.json index 6a8e29c..98c7e3d 100644 --- a/public/locales/zh-CN/dashboard.json +++ b/public/locales/zh-CN/dashboard.json @@ -488,6 +488,53 @@ "selectRegionDes": "选择存储桶所在的区域,或者手动输入区域代码", "enterAccessCredentials": "获取访问密钥,并填写在下方。", "accessKey": "AccessKey", - "chunkSizeLabelS3": "请指定分片上传时的分片大小,范围 5 MB ~ 5 GB。" + "chunkSizeLabelS3": "请指定分片上传时的分片大小,范围 5 MB ~ 5 GB。", + "editPolicy": "编辑存储策略", + "setting":"设置项", + "value": "值", + "description": "描述", + "id": "ID", + "policyID": "存储策略编号", + "policyType": "存储策略类型", + "server": "Server", + "policyEndpoint": "存储端 Endpoint", + "bucketID": "存储桶标识", + "yes": "是", + "no": "否", + "privateBucketDes": "是否为私有空间", + "resourceRootURL": "文件资源根 URL", + "resourceRootURLDes": "预览/获取文件外链时生成 URL 的前缀", + "akDes": "AccessKey / 刷新 Token", + "maxSizeBytes": "最大单文件尺寸 (Bytes)", + "maxSizeBytesDes": "最大可上传的文件尺寸,填写为 0 表示不限制", + "autoRename": "自动重命名", + "autoRenameDes": "是否根据规则对上传物理文件重命名", + "storagePath": "存储路径", + "storagePathDes": "文件物理存储路径", + "fileName": "存储文件名", + "fileNameDes": "文件物理存储文件名", + "allowGetSourceLink": "允许获取外链", + "allowGetSourceLinkDes": "是否允许获取外链。注意,某些存储策略类型不支持,即使在此开启,获取的外链也无法使用", + "upyunToken": "又拍云防盗链 Token", + "upyunOnly": "仅对又拍云存储策略有效", + "allowedFileExtension": "允许文件扩展名", + "emptyIsNoLimit": "留空表示不限制", + "allowedMimetype": "允许的 MimeType", + "qiniuOnly": "仅对七牛存储策略有效", + "odRedirectURL": "OneDrive 重定向地址", + "noModificationNeeded": "一般添加后无需修改", + "odReverseProxy": "OneDrive 反代服务器地址", + "odOnly": "仅对 OneDrive 存储策略有效", + "odDriverID": "OneDrive/SharePoint 驱动器资源标识", + "odDriverIDDes": "仅对 OneDrive 存储策略有效,留空则使用用户的默认 OneDrive 驱动器", + "s3Region": "Amazon S3 Region", + "s3Only": "仅对 Amazon S3 存储策略有效", + "lanEndpoint": "内网 EndPoint", + "ossOnly": "仅对 OSS 存储策略有效", + "chunkSizeBytes": "上传分片大小 (Bytes)", + "chunkSizeBytesDes": "分片上传时单个分片的大小,仅部分存储策略支持", + "placeHolderWithSize": "上传前预支用户存储", + "placeHolderWithSizeDes": "是否在上传会话创建时就对用户存储进行预支,仅部分存储策略支持", + "saveChanges": "保存更改" } } \ No newline at end of file diff --git a/src/component/Admin/Policy/Guid/EditPro.js b/src/component/Admin/Policy/Guid/EditPro.js index 09eb74b..723aa08 100644 --- a/src/component/Admin/Policy/Guid/EditPro.js +++ b/src/component/Admin/Policy/Guid/EditPro.js @@ -15,8 +15,10 @@ import React, { useCallback, useState } from "react"; import { useDispatch } from "react-redux"; import { toggleSnackbar } from "../../../../redux/explorer"; import API from "../../../../middleware/Api"; +import { useTranslation } from "react-i18next"; export default function EditPro(props) { + const { t } = useTranslation("dashboard", { keyPrefix: "policy" }); const [, setLoading] = useState(false); const [policy, setPolicy] = useState(props.policy); @@ -85,7 +87,7 @@ export default function EditPro(props) { ToggleSnackbar( "top", "right", - "存储策略已" + (props.policy ? "保存" : "添加"), + props.policy ? t("policySaved") : t("policyAdded"), "success" ); }) @@ -101,35 +103,35 @@ export default function EditPro(props) { return (
- 编辑存储策略 + {t("editPolicy")}
- 设置项 - - 描述 + {t("setting")} + {t("value")} + {t("description")} - ID + {t("id")} {policy.ID} - 存储策略编号 + {t("policyID")} - 类型 + {t("type")} {policy.Type} - 存储策略类型 + {t("policyType")} - 名称 + {t("name")} @@ -140,11 +142,11 @@ export default function EditPro(props) { /> - 存储策名称 + {t("policyName")} - Server + {t("server")} @@ -158,7 +160,7 @@ export default function EditPro(props) { - BucketName + {t("bucketName")} @@ -170,11 +172,11 @@ export default function EditPro(props) { /> - 存储桶标识 + {t("bucketID")} - 私有空间 + {t("privateBucket")} @@ -189,23 +191,23 @@ export default function EditPro(props) { control={ } - label="是" + label={t("yes")} /> } - label="否" + label={t("no")} /> - 是否为私有空间 + {t("privateBucketDes")} - 文件资源根URL + {t("resourceRootURL")} @@ -215,13 +217,11 @@ export default function EditPro(props) { /> - - 预览/获取文件外链时生成URL的前缀 - + {t("resourceRootURLDes")} - AccessKey + {t("accessKey")} @@ -233,11 +233,11 @@ export default function EditPro(props) { /> - AccessKey / 刷新Token + {t("akDes")} - SecretKey + {t("secretKey")} @@ -249,11 +249,11 @@ export default function EditPro(props) { /> - SecretKey + {t("secretKey")} - 最大单文件尺寸 (Bytes) + {t("maxSizeBytes")} @@ -268,13 +268,11 @@ export default function EditPro(props) { /> - - 最大可上传的文件尺寸,填写为0表示不限制 - + {t("maxSizeBytesDes")} - 自动重命名 + {t("autoRename")} @@ -291,25 +289,23 @@ export default function EditPro(props) { control={ } - label="是" + label={t("yes")} /> } - label="否" + label={t("no")} /> - - 是否根据规则对上传物理文件重命名 - + {t("autoRenameDes")} - 存储路径 + {t("storagePath")} @@ -322,11 +318,11 @@ export default function EditPro(props) { /> - 文件物理存储路径 + {t("storagePathDes")} - 存储文件名 + {t("fileName")} @@ -339,11 +335,11 @@ export default function EditPro(props) { /> - 文件物理存储文件名 + {t("fileNameDes")} - 允许获取外链 + {t("allowGetSourceLink")} @@ -360,25 +356,25 @@ export default function EditPro(props) { control={ } - label="是" + label={t("yes")} /> } - label="否" + label={t("no")} /> - 是否允许获取外链。注意,某些存储策略类型不支持,即使在此开启,获取的外链也无法使用。 + {t("allowGetSourceLinkDes")} - 又拍云防盗链 Token + {t("upyunToken")} @@ -393,11 +389,11 @@ export default function EditPro(props) { /> - 仅对又拍云存储策略有效 + {t("upyunOnly")} - 允许文件扩展名 + {t("allowedFileExtension")} @@ -413,11 +409,11 @@ export default function EditPro(props) { /> - 留空表示不限制 + {t("emptyIsNoLimit")} - 允许的 MimeType + {t("allowedMimetype")} @@ -433,11 +429,11 @@ export default function EditPro(props) { /> - 仅对七牛存储策略有效 + {t("qiniuOnly")} - OneDrive 重定向地址 + {t("odRedirectURL")} @@ -453,11 +449,13 @@ export default function EditPro(props) { /> - 一般添加后无需修改 + + {t("noModificationNeeded")} + - OneDrive 反代服务器地址 + {t("odReverseProxy")} @@ -473,13 +471,11 @@ export default function EditPro(props) { /> - - 仅对 OneDrive 存储策略有效 - + {t("odOnly")} - OneDrive/SharePoint 驱动器资源标识 + {t("odDriverID")} @@ -495,15 +491,11 @@ export default function EditPro(props) { /> - - 仅对 OneDrive - 存储策略有效,留空则使用用户的默认 OneDrive - 驱动器 - + {t("odDriverIDDes")} - Amazon S3 Region + {t("s3Region")} @@ -518,13 +510,11 @@ export default function EditPro(props) { /> - - 仅对 Amazon S3 存储策略有效 - + {t("s3Only")} - 内网 EndPoint + {t("lanEndpoint")} @@ -540,11 +530,11 @@ export default function EditPro(props) { /> - 仅对 OSS 存储策略有效 + {t("ossOnly")} - 上传分片大小 (Bytes) + {t("chunkSizeBytes")} @@ -564,13 +554,11 @@ export default function EditPro(props) { /> - - 分片上传时单个分片的大小,仅部分存储策略支持。 - + {t("chunkSizeBytesDes")} - 上传前预支用户存储 + {t("placeHolderWithSize")} @@ -590,25 +578,25 @@ export default function EditPro(props) { control={ } - label="是" + label={t("yes")} /> } - label="否" + label={t("no")} /> - 是否在上传会话创建时就对用户存储进行预支,仅部分存储策略支持。 + {t("placeHolderWithSizeDes")} - TPS 限制 + {t("tps")} @@ -627,13 +615,11 @@ export default function EditPro(props) { /> - - 仅 OneDrive 存储策略支持。 - + {t("odOnly")} - TPS 突发请求 + {t("tpsBurst")} @@ -652,9 +638,7 @@ export default function EditPro(props) { /> - - 仅 OneDrive 存储策略支持。 - + {t("odOnly")}
@@ -664,7 +648,7 @@ export default function EditPro(props) { variant={"contained"} style={{ margin: 8 }} > - 保存更改 + {t("saveChanges")}