mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 00:13:44 +08:00
chore: better install service prompt translation
This commit is contained in:
parent
a891341e35
commit
0ec4f46052
@ -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}""#
|
||||
);
|
||||
@ -292,7 +281,7 @@ pub async fn reinstall_service() -> Result<()> {
|
||||
service_state.record_install();
|
||||
service_state.last_error = None;
|
||||
service_state.save()?;
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -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 覆写开启",
|
||||
|
Loading…
x
Reference in New Issue
Block a user