feat: fill i18n

This commit is contained in:
GyDi 2022-03-18 14:59:23 +08:00 committed by GitHub
parent ed3fc50858
commit 743963318f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import dayjs from "dayjs";
import { useLockFn } from "ahooks";
import { useSWRConfig } from "swr";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import {
alpha,
Box,
@ -16,13 +17,10 @@ import {
import { RefreshRounded } from "@mui/icons-material";
import { CmdType } from "../../services/types";
import { updateProfile, deleteProfile, viewProfile } from "../../services/cmds";
import relativeTime from "dayjs/plugin/relativeTime";
import parseTraffic from "../../utils/parse-traffic";
import ProfileEdit from "./profile-edit";
import Notice from "../base/base-notice";
dayjs.extend(relativeTime);
const Wrapper = styled(Box)(({ theme }) => ({
width: "100%",
display: "block",
@ -51,6 +49,7 @@ interface Props {
const ProfileItem = (props: Props) => {
const { selected, itemData, onSelect } = props;
const { t } = useTranslation();
const { mutate } = useSWRConfig();
const [loading, setLoading] = useState(loadingCache[itemData.uid] ?? false);
const [anchorEl, setAnchorEl] = useState<any>(null);
@ -271,7 +270,7 @@ const ProfileItem = (props: Props) => {
onClick={item.handler}
sx={{ minWidth: 133 }}
>
{item.label}
{t(item.label)}
</MenuItem>
))}
</Menu>

View File

@ -1,5 +1,6 @@
import dayjs from "dayjs";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import {
alpha,
Box,
@ -11,13 +12,10 @@ import {
} from "@mui/material";
import { CmdType } from "../../services/types";
import { viewProfile } from "../../services/cmds";
import relativeTime from "dayjs/plugin/relativeTime";
import ProfileEdit from "./profile-edit";
import Notice from "../base/base-notice";
import enhance from "../../services/enhance";
dayjs.extend(relativeTime);
const Wrapper = styled(Box)(({ theme }) => ({
width: "100%",
display: "block",
@ -54,6 +52,8 @@ const ProfileMore = (props: Props) => {
} = props;
const { uid, type } = itemData;
const { t } = useTranslation();
const [anchorEl, setAnchorEl] = useState<any>(null);
const [position, setPosition] = useState({ left: 0, top: 0 });
const [editOpen, setEditOpen] = useState(false);
@ -221,7 +221,7 @@ const ProfileMore = (props: Props) => {
onClick={item.handler}
sx={{ minWidth: 133 }}
>
{item.label}
{t(item.label)}
</MenuItem>
))}
</Menu>

View File

@ -18,6 +18,17 @@
"Import": "Import",
"New": "New",
"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",
"Clash Setting": "Clash Setting",

View File

@ -18,6 +18,17 @@
"Import": "导入",
"New": "新建",
"Close All": "关闭全部",
"Select": "使用",
"Edit": "编辑信息",
"File": "打开文件",
"Update": "更新",
"Update(Proxy)": "更新(代理)",
"Delete": "删除",
"Enable": "启用",
"Disable": "禁用",
"Refresh": "刷新",
"To Top": "移到最前",
"To End": "移到末尾",
"Settings": "设置",
"Clash Setting": "Clash 设置",