feat: fill i18n
This commit is contained in:
parent
ed3fc50858
commit
743963318f
@ -2,6 +2,7 @@ import dayjs from "dayjs";
|
|||||||
import { useLockFn } from "ahooks";
|
import { useLockFn } from "ahooks";
|
||||||
import { useSWRConfig } from "swr";
|
import { useSWRConfig } from "swr";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
alpha,
|
alpha,
|
||||||
Box,
|
Box,
|
||||||
@ -16,13 +17,10 @@ import {
|
|||||||
import { RefreshRounded } from "@mui/icons-material";
|
import { RefreshRounded } from "@mui/icons-material";
|
||||||
import { CmdType } from "../../services/types";
|
import { CmdType } from "../../services/types";
|
||||||
import { updateProfile, deleteProfile, viewProfile } from "../../services/cmds";
|
import { updateProfile, deleteProfile, viewProfile } from "../../services/cmds";
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
|
||||||
import parseTraffic from "../../utils/parse-traffic";
|
import parseTraffic from "../../utils/parse-traffic";
|
||||||
import ProfileEdit from "./profile-edit";
|
import ProfileEdit from "./profile-edit";
|
||||||
import Notice from "../base/base-notice";
|
import Notice from "../base/base-notice";
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
|
||||||
|
|
||||||
const Wrapper = styled(Box)(({ theme }) => ({
|
const Wrapper = styled(Box)(({ theme }) => ({
|
||||||
width: "100%",
|
width: "100%",
|
||||||
display: "block",
|
display: "block",
|
||||||
@ -51,6 +49,7 @@ interface Props {
|
|||||||
const ProfileItem = (props: Props) => {
|
const ProfileItem = (props: Props) => {
|
||||||
const { selected, itemData, onSelect } = props;
|
const { selected, itemData, onSelect } = props;
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
const { mutate } = useSWRConfig();
|
const { mutate } = useSWRConfig();
|
||||||
const [loading, setLoading] = useState(loadingCache[itemData.uid] ?? false);
|
const [loading, setLoading] = useState(loadingCache[itemData.uid] ?? false);
|
||||||
const [anchorEl, setAnchorEl] = useState<any>(null);
|
const [anchorEl, setAnchorEl] = useState<any>(null);
|
||||||
@ -271,7 +270,7 @@ const ProfileItem = (props: Props) => {
|
|||||||
onClick={item.handler}
|
onClick={item.handler}
|
||||||
sx={{ minWidth: 133 }}
|
sx={{ minWidth: 133 }}
|
||||||
>
|
>
|
||||||
{item.label}
|
{t(item.label)}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
alpha,
|
alpha,
|
||||||
Box,
|
Box,
|
||||||
@ -11,13 +12,10 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { CmdType } from "../../services/types";
|
import { CmdType } from "../../services/types";
|
||||||
import { viewProfile } from "../../services/cmds";
|
import { viewProfile } from "../../services/cmds";
|
||||||
import relativeTime from "dayjs/plugin/relativeTime";
|
|
||||||
import ProfileEdit from "./profile-edit";
|
import ProfileEdit from "./profile-edit";
|
||||||
import Notice from "../base/base-notice";
|
import Notice from "../base/base-notice";
|
||||||
import enhance from "../../services/enhance";
|
import enhance from "../../services/enhance";
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
|
||||||
|
|
||||||
const Wrapper = styled(Box)(({ theme }) => ({
|
const Wrapper = styled(Box)(({ theme }) => ({
|
||||||
width: "100%",
|
width: "100%",
|
||||||
display: "block",
|
display: "block",
|
||||||
@ -54,6 +52,8 @@ const ProfileMore = (props: Props) => {
|
|||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { uid, type } = itemData;
|
const { uid, type } = itemData;
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState<any>(null);
|
const [anchorEl, setAnchorEl] = useState<any>(null);
|
||||||
const [position, setPosition] = useState({ left: 0, top: 0 });
|
const [position, setPosition] = useState({ left: 0, top: 0 });
|
||||||
const [editOpen, setEditOpen] = useState(false);
|
const [editOpen, setEditOpen] = useState(false);
|
||||||
@ -221,7 +221,7 @@ const ProfileMore = (props: Props) => {
|
|||||||
onClick={item.handler}
|
onClick={item.handler}
|
||||||
sx={{ minWidth: 133 }}
|
sx={{ minWidth: 133 }}
|
||||||
>
|
>
|
||||||
{item.label}
|
{t(item.label)}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@ -18,6 +18,17 @@
|
|||||||
"Import": "Import",
|
"Import": "Import",
|
||||||
"New": "New",
|
"New": "New",
|
||||||
"Close All": "Close All",
|
"Close All": "Close All",
|
||||||
|
"Select": "Select",
|
||||||
|
"Edit": "Edit",
|
||||||
|
"File": "File",
|
||||||
|
"Update": "Update",
|
||||||
|
"Update(Proxy)": "Update(Proxy)",
|
||||||
|
"Delete": "Delete",
|
||||||
|
"Enable": "Enable",
|
||||||
|
"Disable": "Disable",
|
||||||
|
"Refresh": "Refresh",
|
||||||
|
"To Top": "To Top",
|
||||||
|
"To End": "To End",
|
||||||
|
|
||||||
"Settings": "Settings",
|
"Settings": "Settings",
|
||||||
"Clash Setting": "Clash Setting",
|
"Clash Setting": "Clash Setting",
|
||||||
|
@ -18,6 +18,17 @@
|
|||||||
"Import": "导入",
|
"Import": "导入",
|
||||||
"New": "新建",
|
"New": "新建",
|
||||||
"Close All": "关闭全部",
|
"Close All": "关闭全部",
|
||||||
|
"Select": "使用",
|
||||||
|
"Edit": "编辑信息",
|
||||||
|
"File": "打开文件",
|
||||||
|
"Update": "更新",
|
||||||
|
"Update(Proxy)": "更新(代理)",
|
||||||
|
"Delete": "删除",
|
||||||
|
"Enable": "启用",
|
||||||
|
"Disable": "禁用",
|
||||||
|
"Refresh": "刷新",
|
||||||
|
"To Top": "移到最前",
|
||||||
|
"To End": "移到末尾",
|
||||||
|
|
||||||
"Settings": "设置",
|
"Settings": "设置",
|
||||||
"Clash Setting": "Clash 设置",
|
"Clash Setting": "Clash 设置",
|
||||||
|
Loading…
Reference in New Issue
Block a user