feat: i18n supports

This commit is contained in:
GyDi
2022-03-12 23:07:45 +08:00
parent 9f171a01e8
commit 97254a1e3a
19 changed files with 254 additions and 60 deletions

View File

@@ -1,6 +1,7 @@
import useSWR, { useSWRConfig } from "swr";
import { useEffect } from "react";
import { useLockFn } from "ahooks";
import { useTranslation } from "react-i18next";
import { Button, ButtonGroup, List, Paper } from "@mui/material";
import { getClashConfig, updateConfigs } from "../services/api";
import { patchClashConfig } from "../services/cmds";
@@ -10,6 +11,7 @@ import ProxyGroup from "../components/proxy/proxy-group";
import ProxyGlobal from "../components/proxy/proxy-global";
const ProxyPage = () => {
const { t } = useTranslation();
const { mutate } = useSWRConfig();
const { data: proxiesData } = useSWR("getProxies", getProxies);
const { data: clashConfig } = useSWR("getClashConfig", getClashConfig);
@@ -45,7 +47,7 @@ const ProxyPage = () => {
return (
<BasePage
contentStyle={pageStyle}
title={showGroup ? "Proxy Groups" : "Proxies"}
title={showGroup ? t("Proxy Groups") : t("Proxies")}
header={
<ButtonGroup size="small">
{modeList.map((mode) => (
@@ -55,7 +57,7 @@ const ProxyPage = () => {
onClick={() => onChangeMode(mode)}
sx={{ textTransform: "capitalize" }}
>
{mode}
{t(mode)}
</Button>
))}
</ButtonGroup>