Skip to content

Commit

Permalink
cn
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Jul 18, 2024
1 parent 45a36e7 commit 97060c0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion V2rayU.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
};
buildConfigurationList = 664EB36C216C9A5E00B6AE0D /* Build configuration list for PBXProject "V2rayU" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
developmentRegion = "zh-Hans";
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down
2 changes: 1 addition & 1 deletion V2rayU/Base.lproj/ConfigWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ Gw
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" id="0rS-HW-TeI">
<rect key="frame" x="1" y="1" width="375" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" selectionGranularity="word" allowsUndo="YES" allowsNonContiguousLayout="YES" textCompletion="NO" smartInsertDelete="YES" id="dNK-7u-GUm">
<rect key="frame" x="0.0" y="0.0" width="379" height="480"/>
Expand Down
53 changes: 32 additions & 21 deletions V2rayU/V2rayLaunch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ func executeAppleScriptWithOsascript(script: String) {
print("executeAppleScript-Output: \(output)")
} catch {
print("executeAppleScript-Error: \(error)")
let title = NSLocalizedString("InstallFailedTitle", comment: "")
let toast = String(format: NSLocalizedString("InstallFailedMessage", comment: ""), error.localizedDescription, script)
var title = "Install V2rayUTool Failed";
var toast = "Error: \(error),\nYou need execute scripts manually:\n \(script)";
if isMainland {
title = "安装 V2rayUTool 失败"
toast = "安装失败: \(error)\n, 你需要在命令行手动执行一下: \(script)"
}
alertDialog(title: title, message: toast)
}
}
Expand Down Expand Up @@ -126,10 +130,18 @@ class V2rayLaunch: NSObject {
static func showInstallAlert() {
DispatchQueue.main.async {
let alert = NSAlert()
alert.messageText = NSLocalizedString("InstallAlertTitle", comment: "")
alert.alertStyle = .warning
alert.addButton(withTitle: NSLocalizedString("Install", comment: ""))
alert.addButton(withTitle: NSLocalizedString("Quit", comment: ""))
if isMainland {
alert.messageText = "安装V2rayUTool"
alert.informativeText = "V2rayU 需要使用管理员权限安装 V2rayUTool 到 ~/.V2rayU/V2rayUTool"
alert.addButton(withTitle: "安装")
alert.addButton(withTitle: "退出")
} else {
alert.messageText = " Install V2rayUTool"
alert.informativeText = "V2rayU needs to install V2rayUTool into ~/.V2rayU/V2rayUTool with administrator privileges"
alert.addButton(withTitle: "Install")
alert.addButton(withTitle: "Quit")
}
switch alert.runModal() {
case .alertFirstButtonReturn:
install()
Expand Down Expand Up @@ -289,13 +301,12 @@ class V2rayLaunch: NSObject {

// port has been used
if isPortOpen(port: httpPort) {
var toast = "http端口 \(httpPort) 已被使用, 请更换"
var title = "端口已被占用"
if Locale.current.languageCode == "en" {
toast = "http port \(httpPort) has been used, please replace it from advance setting"
title = "Port is already in use"
var toast = "http port \(httpPort) has been used, please replace it from advance setting"
var title = "Port is already in use"
if isMainland {
toast = "http端口 \(httpPort) 已被使用, 请更换"
title = "端口已被占用"
}
NSLocalizedString("", comment: "")
alertDialog(title: title, message: toast)
DispatchQueue.main.async {
preferencesWindowController.show(preferencePane: .advanceTab)
Expand All @@ -306,11 +317,11 @@ class V2rayLaunch: NSObject {

// port has been used
if isPortOpen(port: sockPort) {
var toast = "socks端口 \(sockPort) 已被使用, 请更换"
var title = "端口已被占用"
if Locale.current.languageCode == "en" {
toast = "socks port \(sockPort) has been used, please replace it from advance setting"
title = "Port is already in use"
var toast = "socks port \(sockPort) has been used, please replace it from advance setting"
var title = "Port is already in use"
if isMainland {
toast = "socks端口 \(sockPort) 已被使用, 请更换"
title = "端口已被占用"
}
alertDialog(title: title, message: toast)
DispatchQueue.main.async {
Expand Down Expand Up @@ -385,11 +396,11 @@ class V2rayLaunch: NSObject {
let pacPort = getPacPort()
// port has been used
if isPortOpen(port: pacPort) {
var toast = "pac端口 \(pacPort) 已被使用, 请更换"
var title = "端口已被占用"
if Locale.current.languageCode == "en" {
toast = "pac port \(pacPort) has been used, please replace from advance setting"
title = "Port is already in use"
var toast = "pac port \(pacPort) has been used, please replace from advance setting"
var title = "Port is already in use"
if isMainland {
toast = "pac端口 \(pacPort) 已被使用, 请更换"
title = "端口已被占用"
}
alertDialog(title: title, message: toast)
DispatchQueue.main.async {
Expand Down
4 changes: 0 additions & 4 deletions V2rayU/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@
Created by yanue on 2019/7/17.
Copyright © 2019 yanue. All rights reserved.
*/
/* Alert titles */
"InstallAlertTitle" = "V2rayU needs to install V2rayUTool into ~/.V2rayU/V2rayUTool with administrator privileges";
"InstallFailedTitle" = "Install V2rayUTool Failed"
"InstallFailedMessage" = "Error: %s,\nYou need execute scripts manually:\n %s"
3 changes: 0 additions & 3 deletions V2rayU/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@
Created by yanue on 2019/7/17.
Copyright © 2019 yanue. All rights reserved.
*/
"InstallAlertTitle" = "V2rayU 需要使用管理员权限安装 V2rayUTool 到 ~/.V2rayU/V2rayUTool";
"InstallFailedTitle" = "安装 V2rayUTool 失败"
"InstallFailedMessage" = "安装失败: %s\n, 你需要在命令行手动执行一下: %s"

0 comments on commit 97060c0

Please sign in to comment.