feat(settings): 新增三语即时切换并记录验收与专项边界

This commit is contained in:
2026-10-30 01:30:50 +08:00
parent a871d7046e
commit 1cb67b86e8
18 changed files with 285 additions and 11 deletions
+14
View File
@@ -0,0 +1,14 @@
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 {
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 localized.localizedString(forKey: key, value: nil, table: nil)
}
}