chore: update i18n for change password dialog

This commit is contained in:
Steven
2022-09-17 13:33:40 +08:00
parent f4d0e8c948
commit 13aa61bbc0
5 changed files with 22 additions and 10 deletions

View File

@ -17,7 +17,7 @@ const validateConfig: ValidatorConfig = {
type Props = DialogProps; type Props = DialogProps;
const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => { const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
const { t, locale } = useI18n(); const { t } = useI18n();
const [newPassword, setNewPassword] = useState(""); const [newPassword, setNewPassword] = useState("");
const [newPasswordAgain, setNewPasswordAgain] = useState(""); const [newPasswordAgain, setNewPasswordAgain] = useState("");
@ -53,7 +53,7 @@ const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
const passwordValidResult = validate(newPassword, validateConfig); const passwordValidResult = validate(newPassword, validateConfig);
if (!passwordValidResult.result) { if (!passwordValidResult.result) {
toastHelper.error(t("common.password") + locale === "zh" ? "" : " " + passwordValidResult.reason); toastHelper.error(`${t("common.password")} ${passwordValidResult.reason}`);
return; return;
} }
@ -63,7 +63,7 @@ const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
id: user.id, id: user.id,
password: newPassword, password: newPassword,
}); });
toastHelper.info(t("common.password") + t("common.changed")); toastHelper.info(t("message.password-changed"));
handleCloseBtnClick(); handleCloseBtnClick();
} catch (error: any) { } catch (error: any) {
console.error(error); console.error(error);
@ -74,7 +74,7 @@ const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
return ( return (
<> <>
<div className="dialog-header-container"> <div className="dialog-header-container">
<p className="title-text">{t("common.password" + " " + t("common.change"))}</p> <p className="title-text">{t("setting.account-section.change-password")}</p>
<button className="btn close-btn" onClick={handleCloseBtnClick}> <button className="btn close-btn" onClick={handleCloseBtnClick}>
<Icon.X /> <Icon.X />
</button> </button>

View File

@ -58,6 +58,12 @@ const MyAccountSection = () => {
title: "Reset Open API", title: "Reset Open API",
content: "❗The existing API will be invalidated and a new one will be generated, are you sure you want to reset?", content: "❗The existing API will be invalidated and a new one will be generated, are you sure you want to reset?",
style: "warning", style: "warning",
onConfirm: async () => {
await userService.patchUser({
id: user.id,
resetOpenId: true,
});
},
}); });
}; };

View File

@ -99,7 +99,8 @@
"member": "Member", "member": "Member",
"member-list": "Member list", "member-list": "Member list",
"account-section": { "account-section": {
"title": "Account Information" "title": "Account Information",
"change-password": "Change password"
}, },
"preference-section": { "preference-section": {
"default-memo-visibility": "Default memo visibility", "default-memo-visibility": "Default memo visibility",
@ -128,6 +129,7 @@
"fill-form": "Please fill out this form", "fill-form": "Please fill out this form",
"login-failed": "Login failed", "login-failed": "Login failed",
"signup-failed": "Signup failed", "signup-failed": "Signup failed",
"user-not-found": "User not found" "user-not-found": "User not found",
"password-changed": "Password Changed"
} }
} }

View File

@ -99,7 +99,8 @@
"member": "Thành viên", "member": "Thành viên",
"member-list": "Danh sách thành viên", "member-list": "Danh sách thành viên",
"account-section": { "account-section": {
"title": "Thông tin tài khoản" "title": "Thông tin tài khoản",
"change-password": "đổi mật khẩu"
}, },
"preference-section": { "preference-section": {
"default-memo-visibility": "Chế độ memo mặc định", "default-memo-visibility": "Chế độ memo mặc định",
@ -128,6 +129,7 @@
"fill-form": "Please fill out this form", "fill-form": "Please fill out this form",
"login-failed": "Đăng nhập thất bại", "login-failed": "Đăng nhập thất bại",
"signup-failed": "Đăng ký thất bại", "signup-failed": "Đăng ký thất bại",
"user-not-found": "Không tìm thấy người dùng này" "user-not-found": "Không tìm thấy người dùng này",
"password-changed": "mật khẩu đã được thay đổi"
} }
} }

View File

@ -99,7 +99,8 @@
"member": "成员", "member": "成员",
"member-list": "成员列表", "member-list": "成员列表",
"account-section": { "account-section": {
"title": "账号信息" "title": "账号信息",
"change-password": "修改密码"
}, },
"preference-section": { "preference-section": {
"default-memo-visibility": "默认 Memo 可见性", "default-memo-visibility": "默认 Memo 可见性",
@ -128,6 +129,7 @@
"fill-form": "请填写此表单", "fill-form": "请填写此表单",
"login-failed": "登录失败", "login-failed": "登录失败",
"signup-failed": "注册失败", "signup-failed": "注册失败",
"user-not-found": "未找到用户" "user-not-found": "未找到用户",
"password-changed": "密码已修改"
} }
} }