From 667cd844410c3a6be97d13009ef71cd833140624 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 1 Sep 2022 15:31:39 +0800 Subject: [PATCH] Repo // Simplify handling of localized strings. --- Installer/AppDelegate.swift | 35 +++--- .../Resources/en.lproj/Localizable.strings | 2 - .../Resources/ja.lproj/Localizable.strings | 2 - .../zh-Hans.lproj/Localizable.strings | 2 - .../zh-Hant.lproj/Localizable.strings | 2 - .../ctlInputMethod_Common.swift | 12 +- .../ctlInputMethod_Core.swift | 13 +- .../ctlInputMethod_Menu.swift | 119 +++++++++--------- .../LangModelRelated/LMSymbolNode.swift | 72 ++++------- .../LangModelRelated/mgrLangModel.swift | 32 ++--- Source/WindowControllers/ctlAboutWindow.swift | 4 +- Source/WindowControllers/ctlPrefWindow.swift | 6 +- UserPhraseEditor/ctlAboutWindow.swift | 4 +- 13 files changed, 129 insertions(+), 176 deletions(-) diff --git a/Installer/AppDelegate.swift b/Installer/AppDelegate.swift index 59bce7ba..5383f960 100644 --- a/Installer/AppDelegate.swift +++ b/Installer/AppDelegate.swift @@ -60,6 +60,7 @@ class AppDelegate: NSWindowController, NSApplicationDelegate { guard let installingVersion = Bundle.main.infoDictionary?[kCFBundleVersionKey as String] as? String, + let window = window, let versionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else { return @@ -71,7 +72,7 @@ class AppDelegate: NSWindowController, NSApplicationDelegate { cancelButton.nextKeyView = installButton installButton.nextKeyView = cancelButton if let cell = installButton.cell as? NSButtonCell { - window?.defaultButtonCell = cell + window.defaultButtonCell = cell } if let copyrightLabel = Bundle.main.localizedInfoDictionary?["NSHumanReadableCopyright"] @@ -82,17 +83,12 @@ class AppDelegate: NSWindowController, NSApplicationDelegate { if let eulaContent = Bundle.main.localizedInfoDictionary?["CFEULAContent"] as? String { appEULAContent.string = eulaContent } - appVersionLabel.stringValue = String( - format: "%@ Build %@", versionString, installingVersion - ) + appVersionLabel.stringValue = "\(versionString) Build \(installingVersion)" - window?.title = String( - format: NSLocalizedString("%@ (for version %@, r%@)", comment: ""), window?.title ?? "", - versionString, installingVersion - ) - window?.standardWindowButton(.closeButton)?.isHidden = true - window?.standardWindowButton(.miniaturizeButton)?.isHidden = true - window?.standardWindowButton(.zoomButton)?.isHidden = true + window.title = "\(window.title) (v\(versionString), Build \(installingVersion))" + window.standardWindowButton(.closeButton)?.isHidden = true + window.standardWindowButton(.miniaturizeButton)?.isHidden = true + window.standardWindowButton(.zoomButton)?.isHidden = true if FileManager.default.fileExists( atPath: kTargetPartialPath) @@ -114,8 +110,8 @@ class AppDelegate: NSWindowController, NSApplicationDelegate { installButton.title = NSLocalizedString("Upgrade", comment: "") } - window?.center() - window?.orderFront(self) + window.center() + window.orderFront(self) NSApp.activate(ignoringOtherApps: true) } @@ -126,14 +122,15 @@ class AppDelegate: NSWindowController, NSApplicationDelegate { } @objc func timerTick(_ timer: Timer) { + guard let window = window else { return } let elapsed = Date().timeIntervalSince(translocationRemovalStartTime ?? Date()) if elapsed >= kTranslocationRemovalDeadline { timer.invalidate() - window?.endSheet(progressSheet, returnCode: .cancel) + window.endSheet(progressSheet, returnCode: .cancel) } else if isAppBundleTranslocated(atPath: kTargetPartialPath) == false { progressIndicator.doubleValue = 1.0 timer.invalidate() - window?.endSheet(progressSheet, returnCode: .continue) + window.endSheet(progressSheet, returnCode: .continue) } } @@ -145,15 +142,17 @@ class AppDelegate: NSWindowController, NSApplicationDelegate { // return // } + guard let window = window else { return } + let shouldWaitForTranslocationRemoval = isAppBundleTranslocated(atPath: kTargetPartialPath) - && (window?.responds(to: #selector(NSWindow.beginSheet(_:completionHandler:))) ?? false) + && window.responds(to: #selector(NSWindow.beginSheet(_:completionHandler:))) // 將既存輸入法扔到垃圾桶內 do { let sourceDir = kDestinationPartial let fileManager = FileManager.default - let fileURLString = String(format: "%@/%@", sourceDir, kTargetBundle) + let fileURLString = sourceDir + "/" + kTargetBundle let fileURL = URL(fileURLWithPath: fileURLString) // 檢查檔案是否存在 @@ -176,7 +175,7 @@ class AppDelegate: NSWindowController, NSApplicationDelegate { if shouldWaitForTranslocationRemoval { progressIndicator.startAnimation(self) - window?.beginSheet(progressSheet) { returnCode in + window.beginSheet(progressSheet) { returnCode in DispatchQueue.main.async { if returnCode == .continue { self.installInputMethod( diff --git a/Installer/Resources/en.lproj/Localizable.strings b/Installer/Resources/en.lproj/Localizable.strings index b0111946..97c17897 100644 --- a/Installer/Resources/en.lproj/Localizable.strings +++ b/Installer/Resources/en.lproj/Localizable.strings @@ -17,5 +17,3 @@ "Warning" = "Warning"; "Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources." = "Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources."; "Continue" = "Continue"; - -"%@ (for version %@, r%@)" = "%@ (for version %@, r%@)"; \ No newline at end of file diff --git a/Installer/Resources/ja.lproj/Localizable.strings b/Installer/Resources/ja.lproj/Localizable.strings index 114b4ffb..35bf5714 100644 --- a/Installer/Resources/ja.lproj/Localizable.strings +++ b/Installer/Resources/ja.lproj/Localizable.strings @@ -17,5 +17,3 @@ "Warning" = "お知らせ"; "Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources." = "入力アプリの自動起動はうまく出来なかったかもしれません。ご自分で「システム環境設定→キーボード→入力ソース」で起動してください。"; "Continue" = "続行"; - -"%@ (for version %@, r%@)" = "%@ (for version %@, r%@)"; diff --git a/Installer/Resources/zh-Hans.lproj/Localizable.strings b/Installer/Resources/zh-Hans.lproj/Localizable.strings index 82c97b5d..616afa52 100644 --- a/Installer/Resources/zh-Hans.lproj/Localizable.strings +++ b/Installer/Resources/zh-Hans.lproj/Localizable.strings @@ -17,5 +17,3 @@ "Warning" = "安装不完整"; "Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources." = "输入法已经安装好,但可能没有完全启用。请从「系统偏好设定」 > 「键盘」 > 「输入方式」分页加入输入法。"; "Continue" = "继续"; - -"%@ (for version %@, r%@)" = "%@ (for version %@, r%@)"; \ No newline at end of file diff --git a/Installer/Resources/zh-Hant.lproj/Localizable.strings b/Installer/Resources/zh-Hant.lproj/Localizable.strings index 282e5958..1ed5caf0 100644 --- a/Installer/Resources/zh-Hant.lproj/Localizable.strings +++ b/Installer/Resources/zh-Hant.lproj/Localizable.strings @@ -17,5 +17,3 @@ "Warning" = "安裝不完整"; "Input method may not be fully enabled. Please enable it through System Preferences > Keyboard > Input Sources." = "輸入法已經安裝好,但可能沒有完全啟用。請從「系統偏好設定」 > 「鍵盤」 > 「輸入方式」分頁加入輸入法。"; "Continue" = "繼續"; - -"%@ (for version %@, r%@)" = "%@ (for version %@, r%@)"; diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Common.swift b/Source/Modules/ControllerModules/ctlInputMethod_Common.swift index 626d9384..c8ce5ae5 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Common.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Common.swift @@ -24,12 +24,12 @@ extension ctlInputMethod { if ShiftKeyUpChecker.check(event), !mgrPrefs.disableShiftTogglingAlphanumericalMode { if !shouldUseHandle || (!rencentKeyHandledByKeyHandler && shouldUseHandle) { NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n", - toggleASCIIMode() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - ) + message: NSLocalizedString("Alphanumerical Mode", comment: "") + "\n" + + { + toggleASCIIMode() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() ) } if shouldUseHandle { diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift index 83c226d3..4dd5a663 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift @@ -114,12 +114,13 @@ class ctlInputMethod: IMKInputController { isASCIIMode = false } else { NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n", - isASCIIMode - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Alphanumerical Mode", comment: "") + "\n" + + { + isASCIIMode + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } } diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift b/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift index 67226c9f..c8235ca8 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Menu.swift @@ -211,102 +211,109 @@ extension ctlInputMethod { @objc func toggleSCPCTypingMode(_: Any? = nil) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Per-Char Select Mode", comment: ""), "\n", - mgrPrefs.toggleSCPCTypingModeEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Per-Char Select Mode", comment: "") + "\n" + + { + mgrPrefs.toggleSCPCTypingModeEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func toggleChineseConverter(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Force KangXi Writing", comment: ""), "\n", - mgrPrefs.toggleChineseConversionEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Force KangXi Writing", comment: "") + "\n" + + { + mgrPrefs.toggleChineseConversionEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func toggleShiftJISShinjitaiOutput(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("JIS Shinjitai Output", comment: ""), "\n", - mgrPrefs.toggleShiftJISShinjitaiOutputEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("JIS Shinjitai Output", comment: "") + "\n" + + { + mgrPrefs.toggleShiftJISShinjitaiOutputEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func toggleCurrencyNumerals(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Currency Numeral Output", comment: ""), "\n", - mgrPrefs.toggleCurrencyNumeralsEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Currency Numeral Output", comment: "") + "\n" + + { + mgrPrefs.toggleCurrencyNumeralsEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func toggleHalfWidthPunctuation(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Half-Width Punctuation Mode", comment: ""), - "\n", - mgrPrefs.toggleHalfWidthPunctuationEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Half-Width Punctuation Mode", comment: "") + "\n" + + { + mgrPrefs.toggleHalfWidthPunctuationEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func toggleCNS11643Enabled(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("CNS11643 Mode", comment: ""), "\n", - mgrPrefs.toggleCNS11643Enabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("CNS11643 Mode", comment: "") + "\n" + + { + mgrPrefs.toggleCNS11643Enabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func toggleSymbolEnabled(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Symbol & Emoji Input", comment: ""), "\n", - mgrPrefs.toggleSymbolInputEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Symbol & Emoji Input", comment: "") + "\n" + + { + mgrPrefs.toggleSymbolInputEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func toggleAssociatedPhrasesEnabled(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Per-Char Associated Phrases", comment: ""), - "\n", - mgrPrefs.toggleAssociatedPhrasesEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Per-Char Associated Phrases", comment: "") + "\n" + + { + mgrPrefs.toggleAssociatedPhrasesEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func togglePhraseReplacement(_: Any?) { resetKeyHandler() NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Use Phrase Replacement", comment: ""), "\n", - mgrPrefs.togglePhraseReplacementEnabled() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") - )) + message: NSLocalizedString("Use Phrase Replacement", comment: "") + "\n" + + { + mgrPrefs.togglePhraseReplacementEnabled() + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") + }() + ) } @objc func selfUninstall(_: Any?) { diff --git a/Source/Modules/LangModelRelated/LMSymbolNode.swift b/Source/Modules/LangModelRelated/LMSymbolNode.swift index 00b453b4..53806ef0 100644 --- a/Source/Modules/LangModelRelated/LMSymbolNode.swift +++ b/Source/Modules/LangModelRelated/LMSymbolNode.swift @@ -54,54 +54,30 @@ class SymbolNode { // MARK: - Static data. - static let catCommonSymbols = String( - format: NSLocalizedString("catCommonSymbols", comment: "")) - static let catHoriBrackets = String( - format: NSLocalizedString("catHoriBrackets", comment: "")) - static let catVertBrackets = String( - format: NSLocalizedString("catVertBrackets", comment: "")) - static let catAlphabets = String( - format: NSLocalizedString("catAlphabets", comment: "")) - static let catSpecialNumbers = String( - format: NSLocalizedString("catSpecialNumbers", comment: "")) - static let catMathSymbols = String( - format: NSLocalizedString("catMathSymbols", comment: "")) - static let catCurrencyUnits = String( - format: NSLocalizedString("catCurrencyUnits", comment: "")) - static let catSpecialSymbols = String( - format: NSLocalizedString("catSpecialSymbols", comment: "")) - static let catUnicodeSymbols = String( - format: NSLocalizedString("catUnicodeSymbols", comment: "")) - static let catCircledKanjis = String( - format: NSLocalizedString("catCircledKanjis", comment: "")) - static let catCircledKataKana = String( - format: NSLocalizedString("catCircledKataKana", comment: "")) - static let catBracketKanjis = String( - format: NSLocalizedString("catBracketKanjis", comment: "")) - static let catSingleTableLines = String( - format: NSLocalizedString("catSingleTableLines", comment: "")) - static let catDoubleTableLines = String( - format: NSLocalizedString("catDoubleTableLines", comment: "")) - static let catFillingBlocks = String( - format: NSLocalizedString("catFillingBlocks", comment: "")) - static let catLineSegments = String( - format: NSLocalizedString("catLineSegments", comment: "")) - static let catKana = String( - format: NSLocalizedString("catKana", comment: "")) - static let catCombinations = String( - format: NSLocalizedString("catCombinations", comment: "")) - static let catPhonabets = String( - format: NSLocalizedString("catPhonabets", comment: "")) - static let catCircledASCII = String( - format: NSLocalizedString("catCircledASCII", comment: "")) - static let catBracketedASCII = String( - format: NSLocalizedString("catBracketedASCII", comment: "")) - static let catMusicSymbols = String( - format: NSLocalizedString("catMusicSymbols", comment: "")) - static let catThai = String( - format: NSLocalizedString("catThai", comment: "")) - static let catYi = String( - format: NSLocalizedString("catYi", comment: "")) + static let catCommonSymbols = NSLocalizedString("catCommonSymbols", comment: "") + static let catHoriBrackets = NSLocalizedString("catHoriBrackets", comment: "") + static let catVertBrackets = NSLocalizedString("catVertBrackets", comment: "") + static let catAlphabets = NSLocalizedString("catAlphabets", comment: "") + static let catSpecialNumbers = NSLocalizedString("catSpecialNumbers", comment: "") + static let catMathSymbols = NSLocalizedString("catMathSymbols", comment: "") + static let catCurrencyUnits = NSLocalizedString("catCurrencyUnits", comment: "") + static let catSpecialSymbols = NSLocalizedString("catSpecialSymbols", comment: "") + static let catUnicodeSymbols = NSLocalizedString("catUnicodeSymbols", comment: "") + static let catCircledKanjis = NSLocalizedString("catCircledKanjis", comment: "") + static let catCircledKataKana = NSLocalizedString("catCircledKataKana", comment: "") + static let catBracketKanjis = NSLocalizedString("catBracketKanjis", comment: "") + static let catSingleTableLines = NSLocalizedString("catSingleTableLines", comment: "") + static let catDoubleTableLines = NSLocalizedString("catDoubleTableLines", comment: "") + static let catFillingBlocks = NSLocalizedString("catFillingBlocks", comment: "") + static let catLineSegments = NSLocalizedString("catLineSegments", comment: "") + static let catKana = NSLocalizedString("catKana", comment: "") + static let catCombinations = NSLocalizedString("catCombinations", comment: "") + static let catPhonabets = NSLocalizedString("catPhonabets", comment: "") + static let catCircledASCII = NSLocalizedString("catCircledASCII", comment: "") + static let catBracketedASCII = NSLocalizedString("catBracketedASCII", comment: "") + static let catMusicSymbols = NSLocalizedString("catMusicSymbols", comment: "") + static let catThai = NSLocalizedString("catThai", comment: "") + static let catYi = NSLocalizedString("catYi", comment: "") private(set) static var root: SymbolNode = .init("/") diff --git a/Source/Modules/LangModelRelated/mgrLangModel.swift b/Source/Modules/LangModelRelated/mgrLangModel.swift index 613122e0..8597a494 100644 --- a/Source/Modules/LangModelRelated/mgrLangModel.swift +++ b/Source/Modules/LangModelRelated/mgrLangModel.swift @@ -63,28 +63,20 @@ enum mgrLangModel { } if !gLangModelCHT.isLanguageModelLoaded { NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Loading CHT Core Dict...", comment: "") - ) + message: NSLocalizedString("Loading CHT Core Dict...", comment: "") ) loadCoreLanguageModelFile(filenameSansExtension: "data-cht", langModel: &gLangModelCHT) NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Core Dict loading complete.", comment: "") - ) + message: NSLocalizedString("Core Dict loading complete.", comment: "") ) } if !gLangModelCHS.isLanguageModelLoaded { NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Loading CHS Core Dict...", comment: "") - ) + message: NSLocalizedString("Loading CHS Core Dict...", comment: "") ) loadCoreLanguageModelFile(filenameSansExtension: "data-chs", langModel: &gLangModelCHS) NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Core Dict loading complete.", comment: "") - ) + message: NSLocalizedString("Core Dict loading complete.", comment: "") ) } } @@ -102,15 +94,11 @@ enum mgrLangModel { } if !gLangModelCHS.isLanguageModelLoaded { NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Loading CHS Core Dict...", comment: "") - ) + message: NSLocalizedString("Loading CHS Core Dict...", comment: "") ) loadCoreLanguageModelFile(filenameSansExtension: "data-chs", langModel: &gLangModelCHS) NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Core Dict loading complete.", comment: "") - ) + message: NSLocalizedString("Core Dict loading complete.", comment: "") ) } } else if mode == InputMode.imeModeCHT { @@ -125,15 +113,11 @@ enum mgrLangModel { } if !gLangModelCHT.isLanguageModelLoaded { NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Loading CHT Core Dict...", comment: "") - ) + message: NSLocalizedString("Loading CHT Core Dict...", comment: "") ) loadCoreLanguageModelFile(filenameSansExtension: "data-cht", langModel: &gLangModelCHT) NotifierController.notify( - message: String( - format: "%@", NSLocalizedString("Core Dict loading complete.", comment: "") - ) + message: NSLocalizedString("Core Dict loading complete.", comment: "") ) } } diff --git a/Source/WindowControllers/ctlAboutWindow.swift b/Source/WindowControllers/ctlAboutWindow.swift index a1668be7..78a445aa 100644 --- a/Source/WindowControllers/ctlAboutWindow.swift +++ b/Source/WindowControllers/ctlAboutWindow.swift @@ -36,9 +36,7 @@ class ctlAboutWindow: NSWindowController { if let eulaContent = Bundle.main.localizedInfoDictionary?["CFEULAContent"] as? String { appEULAContent.string = eulaContent } - appVersionLabel.stringValue = String( - format: "%@ Build %@", versionString, installingVersion - ) + appVersionLabel.stringValue = "\(versionString) Build \(installingVersion)" } @IBAction func btnBugReport(_: NSButton) { diff --git a/Source/WindowControllers/ctlPrefWindow.swift b/Source/WindowControllers/ctlPrefWindow.swift index 3bbc5220..f777c66e 100644 --- a/Source/WindowControllers/ctlPrefWindow.swift +++ b/Source/WindowControllers/ctlPrefWindow.swift @@ -100,15 +100,13 @@ class ctlPrefWindow: NSWindowController { basicKeyboardLayoutButton.menu?.removeAllItems() let itmAppleZhuyinBopomofo = NSMenuItem() - itmAppleZhuyinBopomofo.title = String( - format: NSLocalizedString("Apple Zhuyin Bopomofo (Dachen)", comment: "")) + itmAppleZhuyinBopomofo.title = NSLocalizedString("Apple Zhuyin Bopomofo (Dachen)", comment: "") itmAppleZhuyinBopomofo.representedObject = String( "com.apple.keylayout.ZhuyinBopomofo") basicKeyboardLayoutButton.menu?.addItem(itmAppleZhuyinBopomofo) let itmAppleZhuyinEten = NSMenuItem() - itmAppleZhuyinEten.title = String( - format: NSLocalizedString("Apple Zhuyin Eten (Traditional)", comment: "")) + itmAppleZhuyinEten.title = NSLocalizedString("Apple Zhuyin Eten (Traditional)", comment: "") itmAppleZhuyinEten.representedObject = String("com.apple.keylayout.ZhuyinEten") basicKeyboardLayoutButton.menu?.addItem(itmAppleZhuyinEten) diff --git a/UserPhraseEditor/ctlAboutWindow.swift b/UserPhraseEditor/ctlAboutWindow.swift index 6f176ff0..0d520a1f 100644 --- a/UserPhraseEditor/ctlAboutWindow.swift +++ b/UserPhraseEditor/ctlAboutWindow.swift @@ -36,9 +36,7 @@ import Cocoa if let eulaContent = Bundle.main.localizedInfoDictionary?["CFEULAContent"] as? String { appEULAContent.string = eulaContent } - appVersionLabel.stringValue = String( - format: "%@ Build %@", versionString, installingVersion - ) + appVersionLabel.stringValue = "\(versionString) Build \(installingVersion)" } @IBAction func btnWebsite(_: NSButton) {