diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index 97050d572..aa35e533b 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -2202,7 +2202,7 @@ }, "zh-Hans" : { "stringUnit" : { - "state" : "needs_review", + "state" : "translated", "value" : "启用 Beta 特性" } } @@ -2224,6 +2224,38 @@ } } }, + "setting.general.appearance.header" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Appearance" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "外观" + } + } + } + }, + "setting.general.appearance.light_dark_appearance" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Appearance" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "外观" + } + } + } + }, "setting.general.auto_copy.header" : { "localizations" : { "en" : { @@ -2256,6 +2288,38 @@ } } }, + "setting.general.font.font_size.label" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Font Size" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "字体大小" + } + } + } + }, + "setting.general.font.header" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Font" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "字体" + } + } + } + }, "setting.general.input.header" : { "localizations" : { "en" : { diff --git a/Easydict/Feature/Configuration/Appearance.swift b/Easydict/Feature/Configuration/Appearance.swift index 3a59f1124..eb49593cc 100644 --- a/Easydict/Feature/Configuration/Appearance.swift +++ b/Easydict/Feature/Configuration/Appearance.swift @@ -6,9 +6,10 @@ // Copyright © 2023 izual. All rights reserved. // +import Defaults import Foundation -@objc enum AppearenceType: Int, CaseIterable { +@objc enum AppearenceType: Int, CaseIterable, Defaults.Serializable { case followSystem = 0 case light case dark diff --git a/Easydict/NewApp/Configuration/EZConfiguration.swift b/Easydict/NewApp/Configuration/EZConfiguration.swift index 76d54f3d3..79c0381a6 100644 --- a/Easydict/NewApp/Configuration/EZConfiguration.swift +++ b/Easydict/NewApp/Configuration/EZConfiguration.swift @@ -49,4 +49,7 @@ extension Defaults.Keys { static let enableBetaNewApp = Key("EZConfiguration_kEnableBetaNewAppKey", default: false) static let enableBetaFeature = Key("EZBetaFeatureKey", default: false) + + static let appearanceType = Key("EZConfiguration_kApperanceKey", default: .followSystem) + static let fontSizeOptionIndex = Key("EZConfiguration_kTranslationControllerFontKey", default: 0) } diff --git a/Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift b/Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift index e3f39be7e..d633c0f54 100644 --- a/Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift +++ b/Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift @@ -13,6 +13,16 @@ import SwiftUI struct GeneralTab: View { var body: some View { Form { + Section { + Picker("setting.general.appearance.light_dark_appearance", selection: $appearanceType) { + ForEach(AppearenceType.allCases, id: \.rawValue) { option in + Text(option.title) + .tag(option) + } + } + } header: { + Text("setting.general.appearance.header") + } Section { FirstAndSecondLanguageSettingView() Picker("setting.general.language.language_detect_optimize", selection: $languageDetectOptimize) { @@ -94,6 +104,28 @@ struct GeneralTab: View { Text("setting.general.quick_link.header") } + Section { + let bindingFontSize = Binding(get: { + Double(fontSizeOptionIndex) + }, set: { newValue in + fontSizeOptionIndex = UInt(newValue) + }) + Slider(value: bindingFontSize, in: 0.0 ... 4.0, step: 1) { + Text("setting.general.font.font_size.label") + } minimumValueLabel: { + Text("small") + .font(.system(size: 10)) + } maximumValueLabel: { + Text("large") + .font(.system(size: 14)) + } + } header: { + Text("setting.general.font.header") + } footer: { + Text("hints_keyboard_shortcuts_font_size") + .font(.footnote) + } + Section { Toggle(isOn: $launchAtStartup) { Text("launch_at_startup") @@ -160,6 +192,9 @@ struct GeneralTab: View { @Default(.mouseSelectTranslateWindowType) private var mouseSelectTranslateWindowType @Default(.shortcutSelectTranslateWindowType) private var shortcutSelectTranslateWindowType @Default(.enableBetaFeature) private var enableBetaFeature + @Default(.appearanceType) private var appearanceType + + @Default(.fontSizeOptionIndex) private var fontSizeOptionIndex } @available(macOS 13, *)