chore: i18n in toast

This commit is contained in:
Tristan Yang
2023-01-19 08:39:57 +08:00
parent 1f7baef4b6
commit fd8c54e702
34 changed files with 107 additions and 86 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ export default function APIConfig() {
useEffect(() => {
if (isSuccess) {
hideAll();
toast.success("Update API Secret Successfully!");
toast.success(ct("tip.update"));
}
}, [isSuccess]);
const handleToggle = (val: { third_party: boolean }) => {
@@ -21,7 +21,7 @@ const DeleteAPIKeyModal = ({ closeModal, uid, kid }: Props) => {
};
useEffect(() => {
if (isSuccess) {
toast.success("Delete API Key Successfully!");
toast.success(ct("tip.delete"));
closeModal();
}
}, [isSuccess]);
+1 -1
View File
@@ -21,7 +21,7 @@ const DeleteModal = ({ closeModal, uid, name }: Props) => {
};
useEffect(() => {
if (isSuccess) {
toast.success("Delete Bot Successfully!");
toast.success(ct("tip.delete"));
closeModal();
}
}, [isSuccess]);
@@ -38,7 +38,7 @@ const WebhookModal = ({ uid, webhook, closeModal }: Props) => {
};
useEffect(() => {
if (isSuccess) {
toast.success("Update Webhook URL Successfully!");
toast.success(ct("tip.update"));
closeModal();
}
}, [isSuccess]);
+1 -1
View File
@@ -53,7 +53,7 @@ export default function BotConfig() {
};
useEffect(() => {
if (updateAvatarSuccess) {
toast.success("Update Bot Avatar Successfully!");
toast.success(ct("tip.update"));
}
}, [updateAvatarSuccess]);
@@ -28,7 +28,7 @@ const UpdateLicenseModal: FC<Props> = ({ closeModal, updateLicense, updating, up
};
useEffect(() => {
if (updated) {
toast.success("Update Successfully!");
toast.success(ct("tip.update"));
closeModal();
}
}, [updated]);
+1 -1
View File
@@ -50,7 +50,7 @@ const LogoutConfirmModal: FC<Props> = ({ closeModal }) => {
if (clearLocal) {
clearLocalData();
}
toast.success("Logout Successfully");
toast.success(ct("tip.logout"));
}
}, [exited, clearLocal]);
+1 -1
View File
@@ -127,7 +127,7 @@ export default function MyAccount() {
useEffect(() => {
if (uploadSuccess) {
toast.success("update avatar successfully!");
toast.success(ct("tip.update"));
}
}, [uploadSuccess]);
+1 -1
View File
@@ -22,7 +22,7 @@ const Index = () => {
const [updateUrl, { isLoading, isSuccess }] = useUpdateFrontendUrlMutation();
useEffect(() => {
if (isSuccess) {
toast.success("Update Successfully!");
toast.success(ct("tip.update"));
}
}, [isSuccess]);
useEffect(() => {
+2 -1
View File
@@ -12,6 +12,7 @@ import { useAppSelector } from '../../../app/store';
const Index = () => {
const { t } = useTranslation("setting");
const { t: ct } = useTranslation();
const { loginUser, server } = useAppSelector((store) => {
return { loginUser: store.authData.user, server: store.server };
});
@@ -42,7 +43,7 @@ const Index = () => {
}, [server]);
useEffect(() => {
if (uploadSuccess) {
toast.success("Update logo successfully!");
toast.success(ct("tip.update"));
}
}, [uploadSuccess]);
useEffect(() => {
+1 -1
View File
@@ -47,7 +47,7 @@ const ProfileBasicEditModal: FC<Props> = ({
useEffect(() => {
if (isSuccess) {
// todo
toast.success("update user info successfully");
toast.success(t("tip.update"));
closeModal();
}
}, [isSuccess]);
@@ -16,7 +16,6 @@ const RemoveConfirmModal: FC<Props> = ({ closeModal }) => {
const handleRemove = async () => {
try {
await removeCurrentAccount();
// toast.success("Remove Account Successfully!");
} catch (error) {
toast.error("Remove Account Failed!");
}
+2 -1
View File
@@ -36,6 +36,7 @@ interface BaseForm {
const ProfileBasicEditModal: FC<Props> = ({ closeModal }) => {
const { t } = useTranslation("member");
const { t: ct } = useTranslation();
const { data } = useGetCredentialsQuery();
const [input, setInput] = useState<BaseForm>({
current: "",
@@ -63,7 +64,7 @@ const ProfileBasicEditModal: FC<Props> = ({ closeModal }) => {
useEffect(() => {
if (isSuccess) {
// todo
toast.success("update password successfully");
toast.success(ct("tip.update"));
closeModal();
}
}, [isSuccess]);
+3 -2
View File
@@ -15,6 +15,7 @@ import { useTranslation } from "react-i18next";
export default function Logins() {
const { t } = useTranslation("setting", { keyPrefix: "login" });
const { t: ct } = useTranslation();
const {
changed: clientIdChanged,
clientId,
@@ -37,14 +38,14 @@ export default function Logins() {
// 更新google client id
await updateClientIdToServer();
if (!changed) {
toast.success("Configuration Updated!");
toast.success(ct("tip.update"));
}
}
if (github && githubChanged) {
// github config
await updateGithubAuthConfigToServer();
if (!changed) {
toast.success("Configuration Updated!");
toast.success(ct("tip.update"));
}
}
};
+1 -1
View File
@@ -39,7 +39,7 @@ const navs = [
items: [
{
name: "bot",
component: <ServerVersionChecker version="0.3.2"><BotConfig /></ServerVersionChecker>,
component: <ServerVersionChecker version="0.3.4"><BotConfig /></ServerVersionChecker>,
admin: true
},
{