feat: complete i18n

This commit is contained in:
GyDi
2022-09-02 01:05:45 +08:00
parent b23ca2e138
commit 6ce6fed10d
8 changed files with 64 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
import useSWR from "swr";
import { useLockFn } from "ahooks";
import { useTranslation } from "react-i18next";
import { Box, Grid, IconButton, Stack } from "@mui/material";
import { RestartAltRounded } from "@mui/icons-material";
import {
@@ -20,6 +21,7 @@ interface Props {
const EnhancedMode = (props: Props) => {
const { items, chain } = props;
const { t } = useTranslation();
const { mutate: mutateProfiles } = useSWR("getProfiles", getProfiles);
const { data: chainLogs = {}, mutate: mutateLogs } = useSWR(
"getRuntimeLogs",
@@ -96,7 +98,7 @@ const EnhancedMode = (props: Props) => {
<IconButton
size="small"
color="inherit"
title="refresh enhanced profiles"
title={t("Refresh profiles")}
onClick={onEnhance}
>
<RestartAltRounded />

View File

@@ -82,7 +82,7 @@ const InfoEditor = (props: Props) => {
<TextField
{...textFieldProps}
disabled
label="Type"
label={t("Type")}
value={type}
sx={{ input: { textTransform: "capitalize" } }}
/>
@@ -90,7 +90,7 @@ const InfoEditor = (props: Props) => {
<TextField
{...textFieldProps}
autoFocus
label="Name"
label={t("Name")}
value={form.name}
onChange={(e) => setForm({ name: e.target.value })}
onKeyDown={(e) => e.key === "Enter" && onUpdate()}
@@ -98,7 +98,7 @@ const InfoEditor = (props: Props) => {
<TextField
{...textFieldProps}
label="Descriptions"
label={t("Descriptions")}
value={form.desc}
onChange={(e) => setForm({ desc: e.target.value })}
onKeyDown={(e) => e.key === "Enter" && onUpdate()}
@@ -107,7 +107,7 @@ const InfoEditor = (props: Props) => {
{type === "remote" && (
<TextField
{...textFieldProps}
label="Subscription URL"
label={t("Subscription URL")}
value={form.url}
onChange={(e) => setForm({ url: e.target.value })}
onKeyDown={(e) => e.key === "Enter" && onUpdate()}
@@ -128,7 +128,7 @@ const InfoEditor = (props: Props) => {
{((type === "remote" && showOpt) || type === "local") && (
<TextField
{...textFieldProps}
label="Update Interval (mins)"
label={t("Update Interval(mins)")}
value={option.update_interval}
onChange={(e) => {
const str = e.target.value?.replace(/\D/, "");

View File

@@ -91,7 +91,7 @@ const ProfileNew = (props: Props) => {
<InputLabel>Type</InputLabel>
<Select
autoFocus
label="Type"
label={t("Type")}
value={form.type}
onChange={(e) => setForm({ type: e.target.value })}
>
@@ -104,7 +104,7 @@ const ProfileNew = (props: Props) => {
<TextField
{...textFieldProps}
label="Name"
label={t("Name")}
autoComplete="off"
value={form.name}
onChange={(e) => setForm({ name: e.target.value })}
@@ -112,7 +112,7 @@ const ProfileNew = (props: Props) => {
<TextField
{...textFieldProps}
label="Descriptions"
label={t("Descriptions")}
autoComplete="off"
value={form.desc}
onChange={(e) => setForm({ desc: e.target.value })}
@@ -121,7 +121,7 @@ const ProfileNew = (props: Props) => {
{form.type === "remote" && (
<TextField
{...textFieldProps}
label="Subscription URL"
label={t("Subscription URL")}
autoComplete="off"
value={form.url}
onChange={(e) => setForm({ url: e.target.value })}