chore: better install service prompt translation

This commit is contained in:
Tunglies 2025-03-26 03:44:30 +08:00
parent a891341e35
commit 0ec4f46052
2 changed files with 5 additions and 16 deletions

View File

@ -239,6 +239,8 @@ pub async fn reinstall_service() -> Result<()> {
#[cfg(target_os = "macos")]
pub async fn reinstall_service() -> Result<()> {
use crate::utils::i18n::t;
log::info!(target:"app", "reinstall service");
let binary_path = dirs::service_path()?;
@ -256,20 +258,7 @@ pub async fn reinstall_service() -> Result<()> {
let install_shell: String = install_path.to_string_lossy().into_owned();
let uninstall_shell: String = uninstall_path.to_string_lossy().into_owned();
// 获取提示文本,如果 i18n 失败则使用硬编码默认值
let prompt = crate::utils::i18n::t("Service Administrator Prompt");
let prompt = if prompt == "Service Administrator Prompt" {
if Config::verge().latest().language.as_deref() == Some("zh")
|| Config::verge().latest().language.is_none()
{
"Clash Verge 需要使用管理员权限来重新安装系统服务"
} else {
"Clash Verge needs administrator privileges to reinstall the system service"
}
} else {
&prompt
};
let prompt = t("Service Administrator Prompt");
let command = format!(
r#"do shell script "sudo '{uninstall_shell}' && sudo '{install_shell}'" with administrator privileges with prompt "{prompt}""#
);

View File

@ -486,7 +486,7 @@
"Validate Merge File": "验证覆写文件",
"Validation Success": "验证成功",
"Validation Failed": "验证失败",
"Service Administrator Prompt": "Clash Verge 需要使用管理员权限来重新安装系统服务",
"Service Administrator Prompt": "Clash Verge 需要管理员权限安装系统服务",
"DNS Settings": "DNS 设置",
"DNS Overwrite": "DNS 覆写",
"DNS Settings Warning": "如果你不清楚这里的设置请不要修改,并保持 DNS 覆写开启",