feat: add typescript support to i18next
This commit is contained in:
@@ -62,7 +62,8 @@ const Styled = styled.div`
|
||||
`;
|
||||
|
||||
export default function APIConfig() {
|
||||
const { t } = useTranslation(["setting", "common"]);
|
||||
const { t } = useTranslation("setting");
|
||||
const { t: ct } = useTranslation();
|
||||
const { updateConfig, values } = useConfig("login");
|
||||
const { data } = useGetThirdPartySecretQuery();
|
||||
const [updateSecret, { data: updatedSecret, isSuccess, isLoading }] =
|
||||
@@ -99,10 +100,10 @@ export default function APIConfig() {
|
||||
</div>
|
||||
<div className="btns">
|
||||
<Button onClick={() => hideAll()} className="cancel small">
|
||||
{t("action.cancel", { ns: "common" })}
|
||||
{ct("action.cancel")}
|
||||
</Button>
|
||||
<Button disabled={isLoading} className="small danger" onClick={() => updateSecret()}>
|
||||
{t("action.yes", { ns: "common" })}
|
||||
{ct("action.yes")}
|
||||
</Button>
|
||||
</div>
|
||||
</StyledConfirm>
|
||||
|
||||
@@ -48,8 +48,8 @@ const LicensePriceListModal: FC<Props> = ({ closeModal }) => {
|
||||
return (
|
||||
<Modal id="modal-modal">
|
||||
<StyledModal
|
||||
title={t("license.renew") || ""}
|
||||
description={t("license.renew_select") || ""}
|
||||
title={t("license.renew")}
|
||||
description={t("license.renew_select")}
|
||||
buttons={
|
||||
<>
|
||||
<Button onClick={closeModal} className="ghost">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// import React from 'react'
|
||||
import dayjs from 'dayjs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import StyledRadio from "../../../common/component/styled/Radio";
|
||||
|
||||
@@ -9,7 +8,6 @@ const Index = () => {
|
||||
const { t, i18n } = useTranslation("setting");
|
||||
const handleGuestToggle = (v: "zh" | "en") => {
|
||||
i18n.changeLanguage(v);
|
||||
dayjs.locale(v === "zh" ? "zh-cn" : "en");
|
||||
};
|
||||
return (
|
||||
<div className="setting">
|
||||
|
||||
@@ -24,8 +24,8 @@ const RemoveConfirmModal: FC<Props> = ({ closeModal }) => {
|
||||
return (
|
||||
<Modal id="modal-modal">
|
||||
<StyledModal
|
||||
title={t("remove_account") || ""}
|
||||
description={t("remove_account_desc") || ""}
|
||||
title={t("remove_account")}
|
||||
description={t("remove_account_desc")}
|
||||
buttons={
|
||||
<>
|
||||
<Button onClick={closeModal}>{t("action.cancel", { ns: "common" })}</Button>
|
||||
|
||||
@@ -77,8 +77,8 @@ const ProfileBasicEditModal: FC<Props> = ({ closeModal }) => {
|
||||
return (
|
||||
<Modal id="modal-modal">
|
||||
<StyledEdit
|
||||
title={t("change_pwd") || ""}
|
||||
description={t("change_pwd_desc") || ""}
|
||||
title={t("change_pwd")}
|
||||
description={t("change_pwd_desc")}
|
||||
buttons={
|
||||
<>
|
||||
<Button className="cancel" onClick={closeModal}>
|
||||
|
||||
@@ -47,7 +47,7 @@ export default function ConfigFirebase() {
|
||||
onChange={handleChange}
|
||||
value={token_url}
|
||||
name="token_url"
|
||||
placeholder={t("firebase.token_url") || ""}
|
||||
placeholder={t("firebase.token_url")}
|
||||
/>
|
||||
</div>
|
||||
<div className="input">
|
||||
@@ -58,7 +58,7 @@ export default function ConfigFirebase() {
|
||||
onChange={handleChange}
|
||||
value={project_id}
|
||||
name="project_id"
|
||||
placeholder={t("firebase.project_id") || ""}
|
||||
placeholder={t("firebase.project_id")}
|
||||
/>
|
||||
</div>
|
||||
<div className="input">
|
||||
@@ -71,7 +71,7 @@ export default function ConfigFirebase() {
|
||||
onChange={handleChange}
|
||||
value={private_key}
|
||||
name="private_key"
|
||||
placeholder={t("firebase.private_key") || ""}
|
||||
placeholder={t("firebase.private_key")}
|
||||
/>
|
||||
</div>
|
||||
<div className="input">
|
||||
@@ -82,7 +82,7 @@ export default function ConfigFirebase() {
|
||||
onChange={handleChange}
|
||||
value={client_email}
|
||||
name="client_email"
|
||||
placeholder={t("firebase.client_email") || ""}
|
||||
placeholder={t("firebase.client_email")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,7 @@ export default function Setting() {
|
||||
<StyledSettingContainer
|
||||
nav={currNav}
|
||||
closeModal={close}
|
||||
title={t("setting") || ""}
|
||||
title={t("setting")}
|
||||
navs={navs}
|
||||
dangers={[{ title: t("action.logout"), handler: toggleLogoutConfirm }]}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user