diff --git a/ShadowsocksX-NG.xcodeproj/project.pbxproj b/ShadowsocksX-NG.xcodeproj/project.pbxproj index 5311c25..afad399 100644 --- a/ShadowsocksX-NG.xcodeproj/project.pbxproj +++ b/ShadowsocksX-NG.xcodeproj/project.pbxproj @@ -169,7 +169,7 @@ 9B16E5991F99FD0700E54DC5 /* icons8-Blind Filled-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icons8-Blind Filled-50.png"; sourceTree = ""; }; 9B172A601D0ADA5B00B87B9A /* genstrings.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = genstrings.py; sourceTree = ""; }; 9B172A6B1D0ADDDD00B87B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = ""; }; - 9B172A6D1D0ADDE800B87B9A /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; + 9B172A6D1D0ADDE800B87B9A /* zh-Hans */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 9B2080482326AC460075386C /* kcptun.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = kcptun.sh; sourceTree = ""; }; 9B2080492326AC460075386C /* client */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = client; sourceTree = ""; }; 9B2491B51D0ACC3A003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWindowController.xib; sourceTree = ""; }; @@ -610,7 +610,6 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, "zh-Hans", diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index cb1eb88..8e3e090 100755 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -404,7 +404,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele @IBAction func exportDiagnosis(_ sender: NSMenuItem) { let savePanel = NSSavePanel() - savePanel.title = "Save All Server URLs To File".localized + savePanel.title = "Save Diagnosis to File".localized savePanel.canCreateDirectories = true savePanel.allowedFileTypes = ["txt"] savePanel.isExtensionHidden = false @@ -438,7 +438,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele let defaults = UserDefaults.standard let mode = defaults.string(forKey: "ShadowsocksRunningMode") - var serverMenuText = "Servers".localized + var serverMenuText = "Servers - (No Selected)".localized let mgr = ServerProfileManager.instance for p in mgr.profiles { @@ -449,7 +449,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele } else { profileName = p.serverHost } - serverMenuText = "\(serverMenuText) - \(profileName)" + serverMenuText = "Servers".localized + " - \(profileName)" + break } } serversMenuItem.title = serverMenuText @@ -581,22 +582,25 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele let urls: [URL] = userInfo["urls"] as! [URL] let mgr = ServerProfileManager.instance - - var subtitle: String = "" - if userInfo["source"] as! String == "qrcode" { - subtitle = "By scan QR Code".localized - } else if userInfo["source"] as! String == "url" { - subtitle = "By handle SS URL".localized - } else if userInfo["source"] as! String == "pasteboard" { - subtitle = "By import from pasteboard".localized - } - let addCount = mgr.addServerProfileByURL(urls: urls) if addCount > 0 { + var subtitle: String = "" + if userInfo["source"] as! String == "qrcode" { + subtitle = "By scan QR Code".localized + } else if userInfo["source"] as! String == "url" { + subtitle = "By handle SS URL".localized + } else if userInfo["source"] as! String == "pasteboard" { + subtitle = "By import from pasteboard".localized + } + sendNotify("Add \(addCount) Shadowsocks Server Profile".localized, subtitle, "") } else { - sendNotify("", "", "Not found valid qrcode or url of shadowsocks profile".localized) + if userInfo["source"] as! String == "qrcode" { + sendNotify("", "", "Not found valid QRCode of shadowsocks profile".localized) + } else if userInfo["source"] as! String == "url" { + sendNotify("", "", "Not found valid URL of shadowsocks profile".localized) + } } } } diff --git a/ShadowsocksX-NG/Base.lproj/Localizable.strings b/ShadowsocksX-NG/Base.lproj/Localizable.strings index fd28729..0b14a34 100755 --- a/ShadowsocksX-NG/Base.lproj/Localizable.strings +++ b/ShadowsocksX-NG/Base.lproj/Localizable.strings @@ -1,9 +1,67 @@ + + + + + + /* * SHARED STRINGS */ /* - * ./PACUtils.swift + * ./ShadowsocksX-NG/UserRulesController.swift + */ + +"PAC has been updated by User Rules." = "PAC has been updated by User Rules."; + +"It's failed to update PAC by User Rules." = "It's failed to update PAC by User Rules."; + +/* + * ./ShadowsocksX-NG/AppDelegate.swift + */ + +"Global Mode" = "Global Mode"; + +"Manual Mode" = "Manual Mode"; + +"Auto Mode By PAC" = "Auto Mode By PAC"; + +"Shadowsocks: On" = "Shadowsocks: On"; + +"Shadowsocks: Off" = "Shadowsocks: Off"; + +"Export Command Copied." = "Export Command Copied."; + +"Save Diagnosis to File" = "Save Diagnosis to File"; + +"Servers" = "Servers"; + +"Turn Shadowsocks Off" = "Turn Shadowsocks Off"; + +"Turn Shadowsocks On" = "Turn Shadowsocks On"; + +"By scan QR Code" = "By scan QR Code"; + +"By handle SS URL" = "By handle SS URL"; + +"By import from pasteboard" = "By import from pasteboard"; + +"Add \(addCount) Shadowsocks Server Profile" = "Add \(addCount) Shadowsocks Server Profile"; + +"Not found valid QRCode of shadowsocks profile" = "Not found valid QRCode of shadowsocks profile"; + +"Not found valid URL of shadowsocks profile" = "Not found valid URL of shadowsocks profile"; + +/* + * ./ShadowsocksX-NG/ShareServerProfilesWindowController.swift + */ + +"Save QRCode As File" = "Save QRCode As File"; + +"Save All Server URLs To File" = "Save All Server URLs To File"; + +/* + * ./ShadowsocksX-NG/PACUtils.swift */ "PAC has been updated by latest GFW List." = "PAC has been updated by latest GFW List."; @@ -11,51 +69,16 @@ "Failed to download latest GFW List." = "Failed to download latest GFW List."; /* - * ./PreferencesWindowController.swift + * ./ShadowsocksX-NG/ImportWindowController.swift + */ + +"Success to add \(addCount) server." = "Success to add \(addCount) server."; + +"Not found valid shadowsocks server urls." = "Not found valid shadowsocks server urls."; + +/* + * ./ShadowsocksX-NG/PreferencesWindowController.swift */ "New Server" = "New Server"; -/* - * ./AppDelegate.swift - */ - -"Add \(addCount) Shadowsocks Server Profile" = "Add \(addCount) Shadowsocks Server Profile"; - -"Not found valid qrcode or url of shadowsocks profile" = "Not found valid qrcode or url of shadowsocks profile"; - -"By scan QR Code" = "By scan QR Code"; - -"By Handle SS URL" = "By Handle SS URL"; - -" Encryption Method: \(profile.method)" = " Encryption Method: \(profile.method)"; - -"Current server profile is not valid." = "Current server profile is not valid."; - -"No current server profile." = "No current server profile."; - -"Shadowsocks: On" = "Shadowsocks: On"; - -"Turn Shadowsocks Off" = "Turn Shadowsocks Off"; - -"Shadowsocks: Off" = "Shadowsocks: Off"; - -"Turn Shadowsocks On" = "Turn Shadowsocks On"; - -"Proxy - Auto By PAC" = "Proxy - Auto By PAC"; - -"Proxy - Global" = "Proxy - Global"; - -"Proxy - Manual" = "Proxy - Manual"; - -"Servers" = "Servers"; - -"Auto" = "PAC"; - -"Global" = "Global"; - -"Manual" = "Manual"; - -"Show Running Mode On Status Bar" = "Show Running Mode On Status Bar"; - -"Timeout" = "Timeout"; diff --git a/ShadowsocksX-NG/ShareServerProfilesWindowController.swift b/ShadowsocksX-NG/ShareServerProfilesWindowController.swift index e57c3a4..1c1e9f9 100644 --- a/ShadowsocksX-NG/ShareServerProfilesWindowController.swift +++ b/ShadowsocksX-NG/ShareServerProfilesWindowController.swift @@ -72,7 +72,7 @@ class ShareServerProfilesWindowController: NSWindowController @IBAction func saveQRCodeAsFile(_ sender: NSButton) { if let img = qrCodeImageView.image { let savePanel = NSSavePanel() - savePanel.title = "Save All Server URLs To File".localized + savePanel.title = "Save QRCode As File".localized savePanel.canCreateDirectories = true savePanel.allowedFileTypes = ["gif"] savePanel.isExtensionHidden = false diff --git a/ShadowsocksX-NG/Utils.swift b/ShadowsocksX-NG/Utils.swift index 280504c..08956a1 100644 --- a/ShadowsocksX-NG/Utils.swift +++ b/ShadowsocksX-NG/Utils.swift @@ -10,7 +10,11 @@ import Foundation extension String { var localized: String { - return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: "") + return NSLocalizedString(self, tableName: "Localizable", comment: "") + } + + func localized(withComment:String) -> String { + return NSLocalizedString(self, tableName: "Localizable", comment: withComment) } } diff --git a/ShadowsocksX-NG/zh-Hans.lproj/Localizable.strings b/ShadowsocksX-NG/zh-Hans.lproj/Localizable.strings index 4a8f784..c0b45cc 100755 --- a/ShadowsocksX-NG/zh-Hans.lproj/Localizable.strings +++ b/ShadowsocksX-NG/zh-Hans.lproj/Localizable.strings @@ -2,8 +2,6 @@ - - /* * SHARED STRINGS */ @@ -14,30 +12,28 @@ "PAC has been updated by latest GFW List." = "已经使用最新的 GFW List 更新PAC"; -"Failed to download latest GFW List." = "下载 GFW List 失败"; +"It's failed to update PAC by User Rules." = "更新 PAC 失败"; -/* - * ./PreferencesWindowController.swift - */ - -"New Server" = "新服务器"; +"Failed to download latest GFW List." = "下载最新的 GFW 列表失败"; /* * ./AppDelegate.swift */ +"Save Diagnosis to File" = "保存诊断信息到文件"; + +"Global Mode" = "全局模式"; + +"Manual Mode" = "手动模式"; + +"Auto Mode By PAC" = "PAC自动模式"; + "Add \(addCount) Shadowsocks Server Profile" = "已添加\(addCount)个Shadowsocks服务器配置"; "Not found valid qrcode or url of shadowsocks profile" = "没有找到有效的shadowsocks配置二维码或链接"; "By scan QR Code" = "通过扫描二维码"; -" Encription Method: \(profile.method)" = " 加密方法: \(profile.method)"; - -"Current server profile is not valid." = "当前服务器配置无效"; - -"No current server profile." = "未设置当前服务器配置"; - "Shadowsocks: On" = "Shadowsocks: On"; "Turn Shadowsocks Off" = "关闭 Shadowsocks"; @@ -46,21 +42,15 @@ "Turn Shadowsocks On" = "打开 Shadowsocks"; -"Proxy - Auto By PAC" = "代理 - PAC自动(⌃⌘P)"; - -"Proxy - Global" = "代理 - 全局(⌃⌘P)"; - -"Proxy - Manual" = "代理 - 手动"; - "Servers" = "服务器"; -"Auto" = "自动"; +"Servers - (No Selected)" = "服务器 - (未选择)"; -"Global" = "全局"; +"Add \(addCount) Shadowsocks Server Profile" = "新增 \(addCount) 个 Shadowsocks 服务器配置"; -"Manual" = "手动"; +"Not found valid QRCode of shadowsocks profile" = "未找到有效的 shadowsocks 二维码"; -"Show Running Mode On Status Bar" = "在状态栏显示运行模式"; +"Not found valid URL of shadowsocks profile" = "未找到有效的 shadowsocks 链接"; /* * ./HTTPPreferencesWindowController.swift @@ -69,3 +59,27 @@ "Export Command Copied." = "Export 命令已复制至剪贴板"; "Timeout" = "超时"; + +/* + * ./ShadowsocksX-NG/ShareServerProfilesWindowController.swift + */ + +"Save All Server URLs To File" = "保存所有服务器 URL 到文件"; + +"Save QRCode As File" = "保存 QRCode 为文件"; + +/* + * ./ShadowsocksX-NG/ImportWindowController.swift + */ + +"Success to add \(addCount) server." = "成功添加 \(addCount) 个服务器"; + +"Not found valid shadowsocks server urls." = "未找到有效的shadowsocks服务器URL"; + +/* + * ./ShadowsocksX-NG/PreferencesWindowController.swift + */ + +"New Server" = "新建服务器"; + + diff --git a/ShadowsocksX-NG/zh-Hans.lproj/MainMenu.strings b/ShadowsocksX-NG/zh-Hans.lproj/MainMenu.strings index 07ee484..f31efa5 100644 --- a/ShadowsocksX-NG/zh-Hans.lproj/MainMenu.strings +++ b/ShadowsocksX-NG/zh-Hans.lproj/MainMenu.strings @@ -114,4 +114,4 @@ "eNh-vY-utd.title" = "导出诊断信息..."; /* Class = "NSMenuItem"; title = "Import Server URLs..."; ObjectID = "geG-dQ-OYl"; */ -"geG-dQ-OYl.title" = "导入服务器URLs..."; +"geG-dQ-OYl.title" = "导入服务器URL...";