dongchengjie 1 рік тому
батько
коміт
76624c7d83

+ 38 - 0
src/components/base/base-fieldset.tsx

@@ -0,0 +1,38 @@
+import React from "react";
+import { Box, styled } from "@mui/material";
+
+type Props = {
+  label: string;
+  fontSize?: string;
+  width?: string;
+  padding?: string;
+  children?: React.ReactNode;
+};
+
+export const BaseFieldset: React.FC<Props> = (props: Props) => {
+  const Fieldset = styled(Box)(() => ({
+    position: "relative",
+    border: "1px solid #bbb",
+    borderRadius: "5px",
+    width: props.width ?? "auto",
+    padding: props.padding ?? "15px",
+  }));
+
+  const Label = styled("legend")(({ theme }) => ({
+    position: "absolute",
+    top: "-10px",
+    left: props.padding ?? "15px",
+    backgroundColor: theme.palette.background.paper,
+    backgroundImage:
+      "linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16))",
+    color: theme.palette.text.primary,
+    fontSize: props.fontSize ?? "1em",
+  }));
+
+  return (
+    <Fieldset component="fieldset">
+      <Label>{props.label}</Label>
+      {props.children}
+    </Fieldset>
+  );
+};

+ 1 - 0
src/components/profile/profile-item.tsx

@@ -278,6 +278,7 @@ export const ProfileItem = (props: Props) => {
           {/* only if has url can it be updated */}
           {hasUrl && (
             <IconButton
+              title={t("Refresh")}
               sx={{
                 position: "absolute",
                 p: "3px",

+ 3 - 12
src/components/setting/mods/sysproxy-viewer.tsx

@@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next";
 import { IconButton, Tooltip } from "@mui/material";
 import { InfoRounded } from "@mui/icons-material";
 import {
-  Box,
   InputAdornment,
   List,
   ListItem,
@@ -19,6 +18,7 @@ import { getSystemProxy, getAutotemProxy } from "@/services/cmds";
 import { BaseDialog, DialogRef, Notice, Switch } from "@/components/base";
 import { Edit } from "@mui/icons-material";
 import { EditorViewer } from "@/components/profile/editor-viewer";
+import { BaseFieldset } from "@/components/base/base-fieldset";
 const DEFAULT_PAC = `function FindProxyForURL(url, host) {
   return "PROXY 127.0.0.1:%mixed-port%; SOCKS5 127.0.0.1:%mixed-port%; DIRECT;";
 }`;
@@ -113,16 +113,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
       onOk={onSave}
     >
       <List>
-        <Box
-          sx={{
-            border: "1px solid #bbb",
-            borderRadius: "5px",
-            padding: "8px",
-          }}
-        >
-          <Typography variant="body1" sx={{ fontSize: "18px" }}>
-            {t("Current System Proxy")}
-          </Typography>
+        <BaseFieldset label={t("Current System Proxy")} padding="15px 10px">
           <FlexBox>
             <Typography className="label">{t("Enable status")}</Typography>
             <Typography className="value">
@@ -145,7 +136,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
               </FlexBox>
             </>
           )}
-        </Box>
+        </BaseFieldset>
         <ListItem sx={{ padding: "5px 2px" }}>
           <ListItemText primary={t("Use PAC Mode")} />
           <Switch

+ 8 - 6
src/components/setting/mods/web-ui-item.tsx

@@ -13,6 +13,7 @@ import {
   EditRounded,
   OpenInNewRounded,
 } from "@mui/icons-material";
+import { useTranslation } from "react-i18next";
 
 interface Props {
   value?: string;
@@ -35,6 +36,7 @@ export const WebUIItem = (props: Props) => {
 
   const [editing, setEditing] = useState(false);
   const [editValue, setEditValue] = useState(value);
+  const { t } = useTranslation();
 
   if (editing || onlyEdit) {
     return (
@@ -45,12 +47,12 @@ export const WebUIItem = (props: Props) => {
             size="small"
             value={editValue}
             onChange={(e) => setEditValue(e.target.value)}
-            placeholder={`Support %host %port %secret`}
+            placeholder={t("Support %host, %port, %secret")}
             autoComplete="off"
           />
           <IconButton
             size="small"
-            title="Save"
+            title={t("Save")}
             color="inherit"
             onClick={() => {
               onChange(editValue);
@@ -61,7 +63,7 @@ export const WebUIItem = (props: Props) => {
           </IconButton>
           <IconButton
             size="small"
-            title="Cancel"
+            title={t("Cancel")}
             color="inherit"
             onClick={() => {
               onCancel?.();
@@ -100,7 +102,7 @@ export const WebUIItem = (props: Props) => {
         />
         <IconButton
           size="small"
-          title="Open URL"
+          title={t("Open URL")}
           color="inherit"
           onClick={() => onOpenUrl?.(value)}
         >
@@ -108,7 +110,7 @@ export const WebUIItem = (props: Props) => {
         </IconButton>
         <IconButton
           size="small"
-          title="Edit"
+          title={t("Edit")}
           color="inherit"
           onClick={() => {
             setEditing(true);
@@ -119,7 +121,7 @@ export const WebUIItem = (props: Props) => {
         </IconButton>
         <IconButton
           size="small"
-          title="Delete"
+          title={t("Delete")}
           color="inherit"
           onClick={onDelete}
         >

+ 2 - 2
src/components/setting/mods/web-ui-viewer.tsx

@@ -105,10 +105,10 @@ export const WebUIViewer = forwardRef<DialogRef>((props, ref) => {
     >
       {!editing && webUIList.length === 0 && (
         <BaseEmpty
-          text="Empty List"
+          text="Empty"
           extra={
             <Typography mt={2} sx={{ fontSize: "12px" }}>
-              Replace host, port, secret with "%host" "%port" "%secret"
+              {t("Replace host, port, secret with %host, %port, %secret")}
             </Typography>
           }
         />

+ 1 - 1
src/components/test/test-item.tsx

@@ -175,7 +175,7 @@ export const TestItem = (props: Props) => {
                 ":hover": { bgcolor: alpha(palette.primary.main, 0.15) },
               })}
             >
-              Check
+              {t("Test")}
             </Widget>
           )}
 

+ 7 - 3
src/locales/en.json

@@ -90,6 +90,7 @@
   "Update At": "Update At",
 
   "Logs": "Logs",
+  "Pause": "Pause",
   "Clear": "Clear",
 
   "Test": "Test",
@@ -130,13 +131,13 @@
   "Enable status": "Enable Status:",
   "Enabled": "Enabled",
   "Disabled": "Disabled",
-  "Server Addr": "Server Addr:",
+  "Server Addr": "Server Addr: ",
   "Not available": "Not available",
   "Proxy Guard": "Proxy Guard",
   "Proxy Guard Info": "Enable to prevent other software from modifying the operating system's proxy settings",
   "Guard Duration": "Guard Duration",
-  "Proxy Bypass": "Proxy Bypass Settings:",
-  "Bypass": "Bypass:",
+  "Proxy Bypass": "Proxy Bypass Settings: ",
+  "Bypass": "Bypass: ",
   "Use PAC Mode": "Use PAC Mode",
   "PAC Script Content": "PAC Script Content",
   "PAC URL": "PAC URL: ",
@@ -153,6 +154,9 @@
   "External Controller": "External Controller",
   "Core Secret": "Core Secret",
   "Recommended": "Recommended",
+  "Open URL": "Open URL",
+  "Replace host, port, secret with %host, %port, %secret": "Replace host, port, secret with %host, %port, %secret",
+  "Support %host, %port, %secret": "Support %host, %port, %secret",
   "Clash Core": "Clash Core",
   "Upgrade": "Upgrade",
   "Restart": "Restart",

+ 8 - 4
src/locales/fa.json

@@ -90,6 +90,7 @@
   "Update At": "به‌روزرسانی در",
 
   "Logs": "لاگ‌ها",
+  "Pause": "توقف",
   "Clear": "پاک کردن",
 
   "Test": "آزمون",
@@ -130,16 +131,16 @@
   "Enable status": "وضعیت فعال",
   "Enabled": "توانایی فعال شد",
   "Disabled": "غیرفعال شد",
-  "Server Addr": "آدرس سرور",
+  "Server Addr": "آدرس سرور: ",
   "Not available": "غیر فعال شد",
   "Proxy Guard": "محافظ پراکسی",
   "Proxy Guard Info": "امکان جلوگیری از نرم‌افزارهای دیگر از تغییر تنظیمات پروکسی سیستم عامل را فعال کنید",
   "Guard Duration": "مدت محافظت",
-  "Proxy Bypass": "دور زدن پراکسی",
-  "Bypass": "دور زدن",
+  "Proxy Bypass": "دور زدن پراکسی: ",
+  "Bypass": "دور زدن: ",
   "Use PAC Mode": "استفاده از حالت PAC",
   "PAC Script Content": "محتوای اسکریپت PAC",
-  "PAC URL": "PAC URL",
+  "PAC URL": "PAC URL: ",
   "Auto Launch": "راه‌اندازی خودکار",
   "Silent Start": "شروع بی‌صدا",
 
@@ -153,6 +154,9 @@
   "External Controller": "کنترل‌کننده خارجی",
   "Core Secret": "رمز اصلی",
   "Recommended": "توصیه شده",
+  "Open URL": "باز کردن آدرس اینترنتی",
+  "Replace host, port, secret with %host, %port, %secret": "جایگزین کردن میزبان، پورت و رمز با %host، %port، %secret",
+  "Support %host, %port, %secret": "پشتیبانی از %host، %port و %secret",
   "Clash Core": "هسته Clash",
   "Upgrade": "ارتقاء",
   "Restart": "راه‌اندازی مجدد",

+ 9 - 5
src/locales/ru.json

@@ -90,6 +90,7 @@
   "Update At": "Обновлено в",
 
   "Logs": "Логи",
+  "Pause": "Пауза",
   "Clear": "Очистить",
 
   "Test": "Тест",
@@ -130,16 +131,16 @@
   "Enable status": "Статус включения",
   "Enabled": "Включено",
   "Disabled": "Отключено",
-  "Server Addr": "Адрес сервера",
+  "Server Addr": "Адрес сервера: ",
   "Not available": "Недоступно",
   "Proxy Guard": "Защита прокси",
   "Proxy Guard Info": "Включите эту функцию чтобы предотвратить изменение настроек прокси-сервера операционной системы другим программным обеспечением",
   "Guard Duration": "Период защиты",
-  "Proxy Bypass": "Игнорирование прокси",
-  "Bypass": "Игнорирование",
-  "Use PAC Mode": "Используйте режим PAC.",
+  "Proxy Bypass": "Игнорирование прокси: ",
+  "Bypass": "Игнорирование: ",
+  "Use PAC Mode": "Используйте режим PAC",
   "PAC Script Content": "Содержание сценария PAC",
-  "PAC URL": "Адрес PAC",
+  "PAC URL": "Адрес PAC: ",
   "Auto Launch": "Автозапуск",
   "Silent Start": "Тихий запуск",
 
@@ -153,6 +154,9 @@
   "External Controller": "Адрес прослушивания внешнего контроллера",
   "Core Secret": "Секрет",
   "Recommended": "Рекомендуется",
+  "Open URL": "Открыть URL",
+  "Replace host, port, secret with %host, %port, %secret": "Замените хост, порт, секрет на %host, %port, %secret",
+  "Support %host, %port, %secret": "Поддержка %host, %port, %secret",
   "Clash Core": "Ядра Clash",
   "Upgrade": "Обновлять",
   "Restart": "Перезапуск",

+ 7 - 3
src/locales/zh.json

@@ -90,6 +90,7 @@
   "Update At": "更新于",
 
   "Logs": "日志",
+  "Pause": "暂停",
   "Clear": "清除",
 
   "Test": "测试",
@@ -128,8 +129,8 @@
   "System Proxy Setting": "系统代理设置",
   "Current System Proxy": "当前系统代理",
   "Enable status": "开启状态:",
-  "Enabled": "成功",
-  "Disabled": "失败",
+  "Enabled": "已启用",
+  "Disabled": "未启用",
   "Server Addr": "服务地址:",
   "Not available": "不可用",
   "Proxy Guard": "系统代理守卫",
@@ -153,6 +154,9 @@
   "External Controller": "外部控制器监听地址",
   "Core Secret": "API 访问密钥",
   "Recommended": "建议设置",
+  "Open URL": "打开链接",
+  "Replace host, port, secret with %host, %port, %secret": "使用 %host, %port, %secret 表示 主机, 端口, 访问密钥",
+  "Support %host, %port, %secret": "支持 %host, %port, %secret",
   "Clash Core": "Clash 内核",
   "Upgrade": "升级内核",
   "Restart": "重启内核",
@@ -199,7 +203,7 @@
   "App Log Level": "App日志等级",
   "Auto Close Connections": "自动关闭连接",
   "Auto Check Update": "自动检查更新",
-  "Enable Builtin Enhanced": "开启内建增强功能",
+  "Enable Builtin Enhanced": "内置增强功能",
   "Proxy Layout Column": "代理页布局列数",
   "Auto Log Clean": "自动清理日志",
   "Never Clean": "不清理",

+ 1 - 0
src/pages/logs.tsx

@@ -39,6 +39,7 @@ const LogPage = () => {
       header={
         <Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>
           <IconButton
+            title={t("Pause")}
             size="small"
             color="inherit"
             onClick={() => setEnableLog((e) => !e)}