mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 00:13:44 +08:00
feat(cmd): service return message i18 language support
This commit is contained in:
parent
f6c0f144a6
commit
492a5a6de7
@ -1,17 +1,20 @@
|
|||||||
use super::CmdResult;
|
use super::CmdResult;
|
||||||
use crate::core::{service, CoreManager};
|
use crate::{
|
||||||
|
core::{service, CoreManager},
|
||||||
|
utils::i18n::t,
|
||||||
|
};
|
||||||
|
|
||||||
async fn execute_service_operation(
|
async fn execute_service_operation(
|
||||||
service_op: impl std::future::Future<Output = Result<(), impl ToString + std::fmt::Debug>>,
|
service_op: impl std::future::Future<Output = Result<(), impl ToString + std::fmt::Debug>>,
|
||||||
op_type: &str,
|
op_type: &str,
|
||||||
) -> CmdResult {
|
) -> CmdResult {
|
||||||
if service_op.await.is_err() {
|
if service_op.await.is_err() {
|
||||||
let emsg = format!("{} {} failed", op_type, "service");
|
let emsg = format!("{} {} failed", op_type, "Service");
|
||||||
return Err(emsg);
|
return Err(t(emsg.as_str()));
|
||||||
}
|
}
|
||||||
if CoreManager::global().restart_core().await.is_err() {
|
if CoreManager::global().restart_core().await.is_err() {
|
||||||
let emsg = format!("{} {} failed", op_type, "core");
|
let emsg = format!("{} {} failed", "Restart", "Core");
|
||||||
return Err(emsg);
|
return Err(t(emsg.as_str()));
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -201,6 +201,8 @@
|
|||||||
"Tun Mode": "Tun Mode",
|
"Tun Mode": "Tun Mode",
|
||||||
"TUN requires Service Mode": "TUN mode requires install service",
|
"TUN requires Service Mode": "TUN mode requires install service",
|
||||||
"Install Service": "Install Service",
|
"Install Service": "Install Service",
|
||||||
|
"Install Service failed": "Install Service failed",
|
||||||
|
"Restart Core failed": "Restart Core failed",
|
||||||
"Reset to Default": "Reset to Default",
|
"Reset to Default": "Reset to Default",
|
||||||
"Tun Mode Info": "Tun (Virtual NIC) mode: Captures all system traffic, when enabled, there is no need to enable system proxy.",
|
"Tun Mode Info": "Tun (Virtual NIC) mode: Captures all system traffic, when enabled, there is no need to enable system proxy.",
|
||||||
"System Proxy Enabled": "System proxy is enabled, your applications will access the network through the proxy",
|
"System Proxy Enabled": "System proxy is enabled, your applications will access the network through the proxy",
|
||||||
|
@ -201,6 +201,8 @@
|
|||||||
"Tun Mode": "虚拟网卡模式",
|
"Tun Mode": "虚拟网卡模式",
|
||||||
"TUN requires Service Mode": "TUN 模式需要安装服务",
|
"TUN requires Service Mode": "TUN 模式需要安装服务",
|
||||||
"Install Service": "安装服务",
|
"Install Service": "安装服务",
|
||||||
|
"Install Service failed": "安装服务失败",
|
||||||
|
"Restart Core failed": "重启核心失败",
|
||||||
"Reset to Default": "重置为默认值",
|
"Reset to Default": "重置为默认值",
|
||||||
"Tun Mode Info": "TUN(虚拟网卡)模式接管系统所有流量,启用时无须打开系统代理",
|
"Tun Mode Info": "TUN(虚拟网卡)模式接管系统所有流量,启用时无须打开系统代理",
|
||||||
"System Proxy Enabled": "系统代理已启用,您的应用将通过代理访问网络",
|
"System Proxy Enabled": "系统代理已启用,您的应用将通过代理访问网络",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user