From 65efc6babddb28d8d27ff7109e1a117b4867b2ac Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Thu, 9 Jun 2022 16:09:20 +0800 Subject: [PATCH] i18n: captcha settings --- public/locales/en-US/dashboard.json | 37 ++++- public/locales/zh-CN/dashboard.json | 37 ++++- src/component/Admin/Setting/Captcha.js | 210 +++++++++++++++---------- 3 files changed, 198 insertions(+), 86 deletions(-) diff --git a/public/locales/en-US/dashboard.json b/public/locales/en-US/dashboard.json index ecb7a01..a517f2e 100644 --- a/public/locales/en-US/dashboard.json +++ b/public/locales/en-US/dashboard.json @@ -208,6 +208,41 @@ "thumbFormatDes": "Available: png/jpg", "thumbQuality": "Quality", "thumbQualityDes": "Compression quality percentage, valid only for jpg encoding.", - "thumbGC": "Run GC after thumb generated" + "thumbGC": "Run GC after thumb generated", + "captcha": "Captcha", + "captchaType": "Captcha type", + "plainCaptcha": "Plain", + "reCaptchaV2": "reCAPTCHA V2", + "tencentCloudCaptcha": "Tencent Cloud Captcha", + "captchaProvider": "Provider of the captcha service.", + "plainCaptchaTitle": "Plain captcha", + "captchaWidth": "Width", + "captchaHeight": "Height", + "captchaLength": "Length", + "captchaMode": "Mode", + "captchaModeNumber": "Numbers", + "captchaModeLetter": "Letters", + "captchaModeMath": "Math", + "captchaModeNumberLetter": "Numbers + Letters", + "captchaElement": "Elements inside of the captcha image.", + "complexOfNoiseText": "Complex of noise text", + "complexOfNoiseDot": "Complex of noise dots", + "showHollowLine": "Show hollow lines", + "showNoiseDot": "Show noise dots", + "showNoiseText": "Show noise text", + "showSlimeLine": "Show slime lines", + "showSineLine": "Show sine lines", + "siteKey": "Site KEY", + "siteKeyDes": "You can find it at <0>App Management Page0>.", + "siteSecret": "Secret", + "siteSecretDes": "You can find it at <0>App Management Page0>.", + "secretID": "SecretId", + "secretIDDes": "You can find it at <0>Access Management Page0>.", + "secretKey": "SecretKey", + "secretKeyDes": "You can find it at <0>Access Management Page0>.", + "tCaptchaAppID": "APPID", + "tCaptchaAppIDDes": "You can find it at <0>Captcha Management Page0>.", + "tCaptchaSecretKey": "App Secret Key", + "tCaptchaSecretKeyDes": "You can find it at <0>Captcha Management Page0>." } } \ No newline at end of file diff --git a/public/locales/zh-CN/dashboard.json b/public/locales/zh-CN/dashboard.json index 1f746a1..d2ade7d 100644 --- a/public/locales/zh-CN/dashboard.json +++ b/public/locales/zh-CN/dashboard.json @@ -208,6 +208,41 @@ "thumbFormatDes": "可选:png/jpg", "thumbQuality": "图像质量", "thumbQualityDes": "压缩质量百分比,只针对 jpg 编码有效", - "thumbGC": "生成完成后立即回收内存" + "thumbGC": "生成完成后立即回收内存", + "captcha": "验证码", + "captchaType": "验证码类型", + "plainCaptcha": "普通", + "reCaptchaV2": "reCAPTCHA V2", + "tencentCloudCaptcha": "腾讯云验证码", + "captchaProvider": "验证码类型", + "plainCaptchaTitle": "普通验证码", + "captchaWidth": "宽度", + "captchaHeight": "高度", + "captchaLength": "长度", + "captchaMode": "模式", + "captchaModeNumber": "数字", + "captchaModeLetter": "字母", + "captchaModeMath": "算数", + "captchaModeNumberLetter": "数字+字母", + "captchaElement": "验证码的形式", + "complexOfNoiseText": "加强干扰文字", + "complexOfNoiseDot": "加强干扰点", + "showHollowLine": "使用空心线", + "showNoiseDot": "使用噪点", + "showNoiseText": "使用干扰文字", + "showSlimeLine": "使用波浪线", + "showSineLine": "使用正弦线", + "siteKey": "Site KEY", + "siteKeyDes": "<0>应用管理页面0> 获取到的的 网站密钥", + "siteSecret": "Secret", + "siteSecretDes": "<0>应用管理页面0> 获取到的的 秘钥", + "secretID": "SecretId", + "secretIDDes": "<0>访问密钥页面0> 获取到的的 SecretId", + "secretKey": "SecretKey", + "secretKeyDes": "<0>访问密钥页面0> 获取到的的 SecretKey", + "tCaptchaAppID": "APPID", + "tCaptchaAppIDDes": "<0>图形验证页面0> 获取到的的 APPID", + "tCaptchaSecretKey": "App Secret Key", + "tCaptchaSecretKeyDes": "<0>图形验证页面0> 获取到的的 App Secret Key" } } \ No newline at end of file diff --git a/src/component/Admin/Setting/Captcha.js b/src/component/Admin/Setting/Captcha.js index 7204910..0634fa2 100644 --- a/src/component/Admin/Setting/Captcha.js +++ b/src/component/Admin/Setting/Captcha.js @@ -14,7 +14,7 @@ import Link from "@material-ui/core/Link"; import { toggleSnackbar } from "../../../redux/explorer"; import FormControlLabel from "@material-ui/core/FormControlLabel"; import Switch from "@material-ui/core/Switch"; -import { useTranslation } from "react-i18next"; +import { Trans, useTranslation } from "react-i18next"; const useStyles = makeStyles((theme) => ({ root: { @@ -101,7 +101,7 @@ export default function Captcha() { options: option, }) .then(() => { - ToggleSnackbar("top", "right", "设置已更改", "success"); + ToggleSnackbar("top", "right", t("saved"), "success"); }) .catch((error) => { ToggleSnackbar("top", "right", error.message, "error"); @@ -124,29 +124,31 @@ export default function Captcha() {