fix(menubar): 修复图标重复开关并增加右键菜单

This commit is contained in:
2026-11-03 20:09:18 +08:00
parent 92dca8a10c
commit 1f02810b9a
7 changed files with 171 additions and 8 deletions
+3 -3
View File
@@ -2,13 +2,13 @@ import Foundation
/// Native AppKit labels do not consume SwiftUI's locale environment.
nonisolated enum AppLocalization {
static func string(_ key: String, locale: Locale, bundle: Bundle = .main) -> String {
static func string(_ key: String, locale: Locale, bundle: Bundle = .main, table: String? = nil) -> String {
let identifier = Bundle.preferredLocalizations(from: AppLanguage.supported,
forPreferences: [locale.identifier]).first ?? "en"
guard let path = bundle.path(forResource: identifier, ofType: "lproj"),
let localized = Bundle(path: path) else {
return bundle.localizedString(forKey: key, value: nil, table: nil)
return bundle.localizedString(forKey: key, value: nil, table: table)
}
return localized.localizedString(forKey: key, value: nil, table: nil)
return localized.localizedString(forKey: key, value: nil, table: table)
}
}