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 (