Przeglądaj źródła

chore: update notification message and zh translation (#1011)

RikudouPatrickstar 1 rok temu
rodzic
commit
e79f036a70

+ 4 - 4
src/components/setting/mods/clash-core-viewer.tsx

@@ -52,7 +52,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
         mutate("getClashConfig");
         mutate("getVersion");
       }, 100);
-      Notice.success(`Successfully switch to ${core}`, 1000);
+      Notice.success(t("Switched to _clash Core", { core: `${core}` }), 1000);
     } catch (err: any) {
       Notice.error(err?.message || err.toString());
     }
@@ -63,7 +63,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
       await grantPermission(core);
       // 自动重启
       if (core === clash_core) await restartSidecar();
-      Notice.success(`Successfully grant permission to ${core}`, 1000);
+      Notice.success(t("Permissions Granted Successfully for _clash Core", { core: `${core}` }), 1000);
     } catch (err: any) {
       Notice.error(err?.message || err.toString());
     }
@@ -72,7 +72,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
   const onRestart = useLockFn(async () => {
     try {
       await restartSidecar();
-      Notice.success(`Successfully restart core`, 1000);
+      Notice.success(t(`Clash Core Restarted`), 1000);
     } catch (err: any) {
       Notice.error(err?.message || err.toString());
     }
@@ -83,7 +83,7 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
       setUpgrading(true);
       await upgradeCore();
       setUpgrading(false);
-      Notice.success(`Successfully upgrade core`, 1000);
+      Notice.success(t(`Core Version Updated`), 1000);
     } catch (err: any) {
       setUpgrading(false);
       Notice.error(err?.response.data.message || err.toString());

+ 4 - 4
src/components/setting/mods/clash-port-viewer.tsx

@@ -79,18 +79,18 @@ export const ClashPortViewer = forwardRef<DialogRef>((props, ref) => {
       OS === "linux" &&
       new Set([redirPort, tproxyPort, mixedPort, socksPort, port]).size !== 5
     ) {
-      Notice.error("Port conflict!", 4000);
+      Notice.error(t("Port Conflict"), 4000);
       return;
     }
     if (
       OS === "macos" &&
       new Set([redirPort, mixedPort, socksPort, port]).size !== 4
     ) {
-      Notice.error("Port conflict!", 4000);
+      Notice.error(t("Port Conflict"), 4000);
       return;
     }
     if (OS === "windows" && new Set([mixedPort, socksPort, port]).size !== 3) {
-      Notice.error("Port conflict!", 4000);
+      Notice.error(t("Port Conflict"), 4000);
       return;
     }
     try {
@@ -113,7 +113,7 @@ export const ClashPortViewer = forwardRef<DialogRef>((props, ref) => {
       await patchVerge({ verge_socks_enabled: socksEnabled });
       await patchVerge({ verge_http_enabled: httpEnabled });
       setOpen(false);
-      Notice.success("Change Clash port successfully!", 1000);
+      Notice.success(t("Clash Port Modified"), 1000);
     } catch (err: any) {
       Notice.error(err.message || err.toString(), 4000);
     }

+ 1 - 1
src/components/setting/mods/controller-viewer.tsx

@@ -26,7 +26,7 @@ export const ControllerViewer = forwardRef<DialogRef>((props, ref) => {
   const onSave = useLockFn(async () => {
     try {
       await patchInfo({ "external-controller": controller, secret });
-      Notice.success("Change Clash Config successfully!", 1000);
+      Notice.success(t("External Controller Address Modified"), 1000);
       setOpen(false);
     } catch (err: any) {
       Notice.error(err.message || err.toString(), 4000);

+ 2 - 2
src/components/setting/mods/service-viewer.tsx

@@ -43,7 +43,7 @@ export const ServiceViewer = forwardRef<DialogRef, Props>((props, ref) => {
       await installService();
       mutateCheck();
       setOpen(false);
-      Notice.success("Service installed successfully");
+      Notice.success(t("Service Installed Successfully"));
     } catch (err: any) {
       mutateCheck();
       Notice.error(err.message || err.toString());
@@ -59,7 +59,7 @@ export const ServiceViewer = forwardRef<DialogRef, Props>((props, ref) => {
       await uninstallService();
       mutateCheck();
       setOpen(false);
-      Notice.success("Service uninstalled successfully");
+      Notice.success(t("Service Uninstalled Successfully"));
     } catch (err: any) {
       mutateCheck();
       Notice.error(err.message || err.toString());

+ 1 - 1
src/components/setting/mods/sysproxy-viewer.tsx

@@ -53,7 +53,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
 
   const onSave = useLockFn(async () => {
     if (value.duration < 1) {
-      Notice.error("Proxy guard duration at least 1 seconds");
+      Notice.error(t("Proxy Daemon Duration Cannot be Less than 1 Second"));
       return;
     }
 

+ 1 - 1
src/components/setting/mods/tun-viewer.tsx

@@ -68,7 +68,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
       );
       try {
         await enhanceProfiles();
-        Notice.success("Refresh clash config", 1000);
+        Notice.success(t("Settings Applied"), 1000);
       } catch (err: any) {
         Notice.error(err.message || err.toString(), 3000);
       }

+ 2 - 2
src/components/setting/setting-clash.tsx

@@ -54,7 +54,7 @@ const SettingClash = ({ onError }: Props) => {
   const onUpdateGeo = useLockFn(async () => {
     try {
       await updateGeoData();
-      Notice.success("Start update geodata");
+      Notice.success(t("GeoData Updated"));
     } catch (err: any) {
       Notice.error(err?.response.data.message || err.toString());
     }
@@ -120,7 +120,7 @@ const SettingClash = ({ onError }: Props) => {
               color={enable_random_port ? "primary" : "inherit"}
               size="small"
               onClick={() => {
-                Notice.success(t("After restart to take effect"), 1000);
+                Notice.success(t("Restart Application to Apply Modifications"), 1000);
                 onChangeVerge({ enable_random_port: !enable_random_port });
                 patchVerge({ enable_random_port: !enable_random_port });
               }}

+ 1 - 1
src/components/setting/setting-verge.tsx

@@ -67,7 +67,7 @@ const SettingVerge = ({ onError }: Props) => {
     try {
       const info = await checkUpdate();
       if (!info?.shouldUpdate) {
-        Notice.success("No Updates Available");
+        Notice.success(t("Currently on the Latest Version"));
       } else {
         updateRef.current?.open();
       }

+ 21 - 2
src/locales/en.json

@@ -85,7 +85,7 @@
   "Log Level": "Log Level",
   "Port Config": "Port Config",
   "Random Port": "Random Port",
-  "After restart to take effect": "After restart to take effect",
+  "Restart Application to Apply Modifications": "Restart Application to Apply Modifications",
   "External": "External",
   "External Controller": "External Controller",
   "Core Secret": "Core Secret",
@@ -200,5 +200,24 @@
   "System and Mixed Can Only be Used in Service Mode": "System and Mixed Can Only be Used in Service Mode",
   "Information: Please make sure that the Clash Verge Service is installed and enabled": "Information: Please make sure that the Clash Verge Service is installed and enabled",
 
-  "Use Regular Expression": "Use Regular Expression"
+  "Use Regular Expression": "Use Regular Expression",
+
+  "External Controller Address Modified": "External Controller Address Modified",
+  "Clash Port Modified": "Clash Port Modified",
+  "Currently on the Latest Version": "Currently on the Latest Version",
+  "Only YAML Files Supported": "Only YAML Files Supported",
+  "Port Conflict": "Port Conflict",
+  "Proxy Daemon Duration Cannot be Less than 1 Second": "Proxy Daemon Duration Cannot be Less than 1 Second",
+  "Profile Switched": "Profile Switched",
+  "Profile Reactivated": "Profile Reactivated",
+  "Clash Config Updated": "Clash Config Updated",
+  "Settings Applied": "Settings Applied",
+  "Service Installed Successfully": "Service Installed Successfully",
+  "Service Uninstalled Successfully": "Service Uninstalled Successfully",
+  "GeoData Updated": "GeoData Updated",
+  "Permissions Granted Successfully for _clash Core": "Permissions Granted Successfully for {{core}} Core",
+  "Profile Imported Successfully": "Profile Imported Successfully",
+  "Clash Core Restarted": "Clash Core Restarted",
+  "Switched to _clash Core": "Switched to {{core}} Core",
+  "Core Version Updated": "Core Version Updated"
 }

+ 1 - 1
src/locales/ru.json

@@ -85,7 +85,7 @@
   "Log Level": "Уровень логов",
   "Port Config": "Настройка порта",
   "Random Port": "Случайный порт",
-  "After restart to take effect": "Чтобы изменения вступили в силу, необходимо перезапустить приложение",
+  "Restart Application to Apply Modifications": "Чтобы изменения вступили в силу, необходимо перезапустить приложение",
   "External": "Внешний",
   "External Controller": "Адрес прослушивания внешнего контроллера",
   "Core Secret": "Секрет",

+ 21 - 2
src/locales/zh.json

@@ -85,7 +85,7 @@
   "Log Level": "日志等级",
   "Port Config": "端口设置",
   "Random Port": "随机端口",
-  "After restart to take effect": "重启后生效",
+  "Restart Application to Apply Modifications": "重启应用程序以应用修改",
   "External": "外部控制",
   "External Controller": "外部控制器监听地址",
   "Core Secret": "API 访问密钥",
@@ -200,5 +200,24 @@
   "System and Mixed Can Only be Used in Service Mode": "System 和 Mixed 只能在服务模式下使用",
   "Information: Please make sure that the Clash Verge Service is installed and enabled": "提示信息: 请确保 Clash Verge Service 已安装并启用",
 
-  "Use Regular Expression": "使用正则表达式"
+  "Use Regular Expression": "使用正则表达式",
+
+  "External Controller Address Modified": "外部控制器监听地址已修改",
+  "Clash Port Modified": "Clash 端口已修改",
+  "Currently on the Latest Version": "当前已是最新版本",
+  "Only YAML Files Supported": "仅支持 YAML 文件",
+  "Port Conflict": "端口冲突",
+  "Proxy Daemon Duration Cannot be Less than 1 Second": "代理守护间隔时间不得低于1秒",
+  "Profile Switched": "订阅已切换",
+  "Profile Reactivated": "订阅已激活",
+  "Clash Config Updated": "Clash 配置已更新",
+  "Settings Applied": "设置已应用",
+  "Service Installed Successfully": "已成功安装服务",
+  "Service Uninstalled Successfully": "已成功卸载服务",
+  "GeoData Updated": "已更新 GeoData",
+  "Permissions Granted Successfully for _clash Core": "{{core}} 内核授权成功",
+  "Profile Imported Successfully": "导入订阅成功",
+  "Clash Core Restarted": "已重启 Clash 内核",
+  "Switched to _clash Core": "已切换至 {{core}} 内核",
+  "Core Version Updated": "内核版本已更新"
 }

+ 1 - 1
src/pages/_layout.tsx

@@ -72,7 +72,7 @@ const Layout = () => {
       const [status, msg] = payload as [string, string];
       switch (status) {
         case "set_config::ok":
-          Notice.success("Refresh clash config");
+          Notice.success(t("Clash Config Updated"));
           break;
         case "set_config::error":
           Notice.error(msg);

+ 4 - 4
src/pages/profiles.tsx

@@ -72,7 +72,7 @@ const ProfilePage = () => {
       const fileList = event.payload as string[];
       for (let file of fileList) {
         if (!file.endsWith(".yaml") && !file.endsWith(".yml")) {
-          Notice.error("Only support YAML files.");
+          Notice.error(t("Only YAML Files Supported"));
           continue;
         }
         const item = {
@@ -136,7 +136,7 @@ const ProfilePage = () => {
 
     try {
       await importProfile(url);
-      Notice.success("Successfully import profile.");
+      Notice.success(t("Profile Imported Successfully"));
       setUrl("");
       setLoading(false);
 
@@ -179,7 +179,7 @@ const ProfilePage = () => {
       mutateLogs();
       closeAllConnections();
       setTimeout(() => activateSelected(), 2000);
-      Notice.success("Refresh clash config", 1000);
+      Notice.success(t("Profile Switched"), 1000);
     } catch (err: any) {
       Notice.error(err?.message || err.toString(), 4000);
     } finally {
@@ -192,7 +192,7 @@ const ProfilePage = () => {
     try {
       await enhanceProfiles();
       mutateLogs();
-      Notice.success("Refresh clash config", 1000);
+      Notice.success(t("Profile Reactivated"), 1000);
     } catch (err: any) {
       Notice.error(err.message || err.toString(), 3000);
     }