|
@@ -77,7 +77,7 @@ import Cocoa
|
|
|
case Chinese_CN
|
|
|
case Protuguese
|
|
|
case Arabic
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//外观修改时调用
|
|
@@ -85,7 +85,7 @@ let APPAppearanceChangedNotificationName = NSNotification.Name("APPAppeara
|
|
|
|
|
|
//语言修改时调用
|
|
|
let APPLanguageChangedNotificationName = NSNotification.Name("APPLanguageChangedNotificationName")
|
|
|
-
|
|
|
+
|
|
|
//高亮Form表单域修改时调用
|
|
|
let kPDFViewHighlightFormFiledUpdateNotiName = NSNotification.Name("kPDFViewHighlightFormFiledUpdateNotiName")
|
|
|
|
|
@@ -112,14 +112,14 @@ var settingsDefaultOpenTypeKey = "settingsDefaultOpenTypeKey"
|
|
|
|
|
|
var settingsPanelOpenTypeKey = "settingsPanelOpenTypeKey"
|
|
|
var settingsShowQuickActionBarKey = "settingsShowQuickActionBarKey"
|
|
|
-
|
|
|
+
|
|
|
var autoScrollTimeIntervalKey = "autoScrollTimeIntervalKey"
|
|
|
var autoScrollJumpSpaceKey = "autoScrollJumpSpaceKey"
|
|
|
|
|
|
class SettingsManager: NSObject {
|
|
|
|
|
|
static let sharedInstance = SettingsManager.init()
|
|
|
-
|
|
|
+
|
|
|
override init() {
|
|
|
super.init()
|
|
|
|
|
@@ -127,16 +127,16 @@ class SettingsManager: NSObject {
|
|
|
}
|
|
|
|
|
|
func config() {
|
|
|
-
|
|
|
+
|
|
|
self.loadData()
|
|
|
-
|
|
|
-// if appearance == .autoMode {
|
|
|
-//
|
|
|
-// } else if appearance == .lightMode {
|
|
|
-// NSApplication.shared.appearance = NSAppearance(named: .aqua)
|
|
|
-// } else if appearance == .darkMode {
|
|
|
-// NSApplication.shared.appearance = NSAppearance(named: .darkAqua)
|
|
|
-// }
|
|
|
+
|
|
|
+ // if appearance == .autoMode {
|
|
|
+ //
|
|
|
+ // } else if appearance == .lightMode {
|
|
|
+ // NSApplication.shared.appearance = NSAppearance(named: .aqua)
|
|
|
+ // } else if appearance == .darkMode {
|
|
|
+ // NSApplication.shared.appearance = NSAppearance(named: .darkAqua)
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -168,7 +168,7 @@ class SettingsManager: NSObject {
|
|
|
self.defaultOpen = defaultOpenType(rawValue: UserDefaults.standard.integer(forKey: settingsDefaultOpenTypeKey)) ?? .thumbnail
|
|
|
self.autoExpandPropertyPanel = UserDefaults.standard.bool(forKey: settingsPanelOpenTypeKey)
|
|
|
self.showQuickActionBar = UserDefaults.standard.bool(forKey: settingsShowQuickActionBarKey)
|
|
|
-
|
|
|
+
|
|
|
let autoScrollTimeInterval = UserDefaults.standard.float(forKey: autoScrollTimeIntervalKey)
|
|
|
if autoScrollTimeInterval > 5 {
|
|
|
self.autoScrollTimeInterval = autoScrollTimeInterval.cgFloat
|
|
@@ -203,7 +203,7 @@ class SettingsManager: NSObject {
|
|
|
UserDefaults.standard.setValue(autoExpandPropertyPanel, forKey: settingsPanelOpenTypeKey)
|
|
|
UserDefaults.standard.setValue(defaultOpen.rawValue, forKey: settingsDefaultOpenTypeKey)
|
|
|
UserDefaults.standard.setValue(showQuickActionBar, forKey: settingsShowQuickActionBarKey)
|
|
|
- UserDefaults.standard.setValue(autoScrollTimeInterval, forKey: autoScrollTimeIntervalKey)
|
|
|
+ UserDefaults.standard.setValue(autoScrollTimeInterval, forKey: autoScrollTimeIntervalKey)
|
|
|
UserDefaults.standard.setValue(autoScrollJumpSpace, forKey: autoScrollJumpSpaceKey)
|
|
|
|
|
|
}
|
|
@@ -244,9 +244,9 @@ class SettingsManager: NSObject {
|
|
|
}
|
|
|
|
|
|
var autoSaveMinutes: String = "" {
|
|
|
- didSet {
|
|
|
- UserDefaults.standard.setValue(autoSaveMinutes, forKey: settingsAutoSaveMinutesKey)
|
|
|
- }
|
|
|
+ didSet {
|
|
|
+ UserDefaults.standard.setValue(autoSaveMinutes, forKey: settingsAutoSaveMinutesKey)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
var fileListCount: Int = 10 {
|
|
@@ -324,7 +324,7 @@ class SettingsManager: NSObject {
|
|
|
self.autoSaveMinutes = "15"
|
|
|
self.fileListCount = 10
|
|
|
self.keychainType = .ask
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
func resetPageDisplayData() {
|
|
@@ -337,49 +337,52 @@ class SettingsManager: NSObject {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ func closeFileIsPrompt() -> Bool {
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //MARK: - Method
|
|
|
+//MARK: - Method
|
|
|
+
|
|
|
+public func KMLocalizedString(_ key: String, comment: String? = nil) -> String {
|
|
|
|
|
|
- public func KMLocalizedString(_ key: String, comment: String? = nil) -> String {
|
|
|
-
|
|
|
- var bundlePath: String? = nil
|
|
|
-
|
|
|
- if SettingsManager.sharedInstance.language != .FollowSystem {
|
|
|
- if SettingsManager.sharedInstance.language == .English {
|
|
|
- bundlePath = Bundle.main.path(forResource: "en", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Chinese_TW {
|
|
|
- bundlePath = Bundle.main.path(forResource: "zh-Hans", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Dutch {
|
|
|
- bundlePath = Bundle.main.path(forResource: "nl", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .French {
|
|
|
- bundlePath = Bundle.main.path(forResource: "fr", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .German {
|
|
|
- bundlePath = Bundle.main.path(forResource: "de", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Italian {
|
|
|
- bundlePath = Bundle.main.path(forResource: "it", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Japanese {
|
|
|
- bundlePath = Bundle.main.path(forResource: "ja", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Polish {
|
|
|
- bundlePath = Bundle.main.path(forResource: "pl", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Russian {
|
|
|
- bundlePath = Bundle.main.path(forResource: "ru", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Spanish {
|
|
|
- bundlePath = Bundle.main.path(forResource: "es", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Chinese_CN {
|
|
|
- bundlePath = Bundle.main.path(forResource: "zh-Hans", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Protuguese {
|
|
|
- bundlePath = Bundle.main.path(forResource: "pt", ofType: "lproj")
|
|
|
- } else if SettingsManager.sharedInstance.language == .Arabic {
|
|
|
- bundlePath = Bundle.main.path(forResource: "ar", ofType: "lproj")
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if let bPath = bundlePath, let bundle = Bundle.init(path: bPath) {
|
|
|
- return NSLocalizedString(key, tableName: "Localizable", bundle: bundle, comment: comment ?? "")
|
|
|
- } else {
|
|
|
- return NSLocalizedString(key, comment: "")
|
|
|
+ var bundlePath: String? = nil
|
|
|
+
|
|
|
+ if SettingsManager.sharedInstance.language != .FollowSystem {
|
|
|
+ if SettingsManager.sharedInstance.language == .English {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "en", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Chinese_TW {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "zh-Hans", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Dutch {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "nl", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .French {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "fr", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .German {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "de", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Italian {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "it", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Japanese {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "ja", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Polish {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "pl", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Russian {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "ru", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Spanish {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "es", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Chinese_CN {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "zh-Hans", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Protuguese {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "pt", ofType: "lproj")
|
|
|
+ } else if SettingsManager.sharedInstance.language == .Arabic {
|
|
|
+ bundlePath = Bundle.main.path(forResource: "ar", ofType: "lproj")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ if let bPath = bundlePath, let bundle = Bundle.init(path: bPath) {
|
|
|
+ return NSLocalizedString(key, tableName: "Localizable", bundle: bundle, comment: comment ?? "")
|
|
|
+ } else {
|
|
|
+ return NSLocalizedString(key, comment: "")
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|