PrefUI // Use AppStorage to handle UserDefaults, plus comment fix.

This commit is contained in:
ShikiSuen 2023-03-05 22:02:25 +08:00
parent b715325db3
commit 8541c3b9e6
14 changed files with 420 additions and 441 deletions

View File

@ -10,36 +10,50 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneBehavior: View {
@State private var selChooseCandidateUsingSpace = UserDefaults.standard.bool(
forKey: UserDef.kChooseCandidateUsingSpace.rawValue)
@State private var selKeyBehaviorShiftTab =
UserDefaults.standard.bool(forKey: UserDef.kSpecifyShiftTabKeyBehavior.rawValue) ? 1 : 0
@State private var selKeyBehaviorShiftSpace =
UserDefaults.standard.bool(
forKey: UserDef.kSpecifyShiftSpaceKeyBehavior.rawValue) ? 1 : 0
@State private var selKeyBehaviorESCForClearingTheBuffer = UserDefaults.standard.bool(
forKey: UserDef.kEscToCleanInputBuffer.rawValue)
@State private var selAlsoConfirmAssociatedCandidatesByEnter = UserDefaults.standard.bool(
forKey: UserDef.kAlsoConfirmAssociatedCandidatesByEnter.rawValue)
@State private var selTogglingAlphanumericalModeWithLShift = UserDefaults.standard.bool(
forKey: UserDef.kTogglingAlphanumericalModeWithLShift.rawValue)
@State private var selTogglingAlphanumericalModeWithRShift = UserDefaults.standard.bool(
forKey: UserDef.kTogglingAlphanumericalModeWithRShift.rawValue)
@State private var selUpperCaseLetterKeyBehavior = UserDefaults.standard.integer(
forKey: UserDef.kUpperCaseLetterKeyBehavior.rawValue)
@State private var selSpecifyIntonationKeyBehavior = UserDefaults.standard.integer(
forKey: UserDef.kSpecifyIntonationKeyBehavior.rawValue)
@State private var selSpecifyShiftBackSpaceKeyBehavior = UserDefaults.standard.integer(
forKey: UserDef.kSpecifyShiftBackSpaceKeyBehavior.rawValue)
@State private var selAlwaysShowTooltipTextsHorizontally = UserDefaults.standard.bool(
forKey: UserDef.kAlwaysShowTooltipTextsHorizontally.rawValue)
@State private var selShowNotificationsWhenTogglingCapsLock = UserDefaults.standard.bool(
forKey: UserDef.kShowNotificationsWhenTogglingCapsLock.rawValue)
@State private var selShareAlphanumericalModeStatusAcrossClients = UserDefaults.standard.bool(
forKey: UserDef.kShareAlphanumericalModeStatusAcrossClients.rawValue)
// MARK: - AppStorage Variables
@Backport.AppStorage(wrappedValue: true, UserDef.kChooseCandidateUsingSpace.rawValue)
private var chooseCandidateUsingSpace: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kEscToCleanInputBuffer.rawValue)
private var escToCleanInputBuffer: Bool
@Backport.AppStorage(wrappedValue: 0, UserDef.kSpecifyIntonationKeyBehavior.rawValue)
private var specifyIntonationKeyBehavior: Int
@Backport.AppStorage(wrappedValue: 0, UserDef.kSpecifyShiftBackSpaceKeyBehavior.rawValue)
private var specifyShiftBackSpaceKeyBehavior: Int
@Backport.AppStorage(wrappedValue: false, UserDef.kSpecifyShiftTabKeyBehavior.rawValue)
private var specifyShiftTabKeyBehavior: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kSpecifyShiftSpaceKeyBehavior.rawValue)
private var specifyShiftSpaceKeyBehavior: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kAlsoConfirmAssociatedCandidatesByEnter.rawValue)
private var alsoConfirmAssociatedCandidatesByEnter: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kTogglingAlphanumericalModeWithLShift.rawValue)
private var togglingAlphanumericalModeWithLShift: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kTogglingAlphanumericalModeWithRShift.rawValue)
private var togglingAlphanumericalModeWithRShift: Bool
@Backport.AppStorage(wrappedValue: 0, UserDef.kUpperCaseLetterKeyBehavior.rawValue)
private var upperCaseLetterKeyBehavior: Int
@Backport.AppStorage(wrappedValue: false, UserDef.kAlwaysShowTooltipTextsHorizontally.rawValue)
private var alwaysShowTooltipTextsHorizontally: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kShowNotificationsWhenTogglingCapsLock.rawValue)
private var showNotificationsWhenTogglingCapsLock: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kShareAlphanumericalModeStatusAcrossClients.rawValue)
private var shareAlphanumericalModeStatusAcrossClients: Bool
var macOSMontereyOrLaterDetected: Bool {
if #available(macOS 12, *) {
@ -48,15 +62,15 @@ struct VwrPrefPaneBehavior: View {
return false
}
// MARK: - Main View
var body: some View {
ScrollView {
SSPreferences.Container(contentWidth: CtlPrefUIShared.contentWidth) {
SSPreferences.Section(title: "Space:".localized, bottomDivider: true) {
Toggle(
LocalizedStringKey("Enable Space key for calling candidate window"),
isOn: $selChooseCandidateUsingSpace.onChange {
PrefMgr.shared.chooseCandidateUsingSpace = selChooseCandidateUsingSpace
}
isOn: $chooseCandidateUsingSpace
)
Text(
LocalizedStringKey(
@ -68,9 +82,7 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "ESC:".localized, bottomDivider: true) {
Toggle(
LocalizedStringKey("Use ESC key to clear the entire input buffer"),
isOn: $selKeyBehaviorESCForClearingTheBuffer.onChange {
PrefMgr.shared.escToCleanInputBuffer = selKeyBehaviorESCForClearingTheBuffer
}
isOn: $escToCleanInputBuffer
)
Text(
LocalizedStringKey(
@ -82,9 +94,7 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "Enter:".localized, bottomDivider: true) {
Toggle(
LocalizedStringKey("Allow using Enter key to confirm associated candidate selection"),
isOn: $selAlsoConfirmAssociatedCandidatesByEnter.onChange {
PrefMgr.shared.alsoConfirmAssociatedCandidatesByEnter = selAlsoConfirmAssociatedCandidatesByEnter
}
isOn: $alsoConfirmAssociatedCandidatesByEnter
)
Text(
LocalizedStringKey(
@ -96,9 +106,7 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "Shift+BackSpace:".localized, bottomDivider: true) {
Picker(
"",
selection: $selSpecifyShiftBackSpaceKeyBehavior.onChange {
PrefMgr.shared.specifyShiftBackSpaceKeyBehavior = selSpecifyShiftBackSpaceKeyBehavior
}
selection: $specifyShiftBackSpaceKeyBehavior
) {
Text(LocalizedStringKey("Disassemble the previous reading, dropping its intonation")).tag(0)
Text(LocalizedStringKey("Clear the entire inline composition buffer like Shift+Delete")).tag(1)
@ -112,12 +120,10 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "(Shift+)Tab:", bottomDivider: true) {
Picker(
"",
selection: $selKeyBehaviorShiftTab.onChange {
PrefMgr.shared.specifyShiftTabKeyBehavior = (selKeyBehaviorShiftTab == 1) ? true : false
}
selection: $specifyShiftTabKeyBehavior
) {
Text(LocalizedStringKey("for revolving candidates")).tag(0)
Text(LocalizedStringKey("for revolving pages")).tag(1)
Text(LocalizedStringKey("for revolving candidates")).tag(false)
Text(LocalizedStringKey("for revolving pages")).tag(true)
}
.labelsHidden()
.horizontalRadioGroupLayout()
@ -128,12 +134,10 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "(Shift+)Space:".localized, bottomDivider: true) {
Picker(
"",
selection: $selKeyBehaviorShiftSpace.onChange {
PrefMgr.shared.specifyShiftSpaceKeyBehavior = (selKeyBehaviorShiftSpace == 1) ? true : false
}
selection: $specifyShiftSpaceKeyBehavior
) {
Text(LocalizedStringKey("Space to +revolve candidates, Shift+Space to +revolve pages")).tag(0)
Text(LocalizedStringKey("Space to +revolve pages, Shift+Space to +revolve candidates")).tag(1)
Text(LocalizedStringKey("Space to +revolve candidates, Shift+Space to +revolve pages")).tag(false)
Text(LocalizedStringKey("Space to +revolve pages, Shift+Space to +revolve candidates")).tag(true)
}
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
@ -143,9 +147,7 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "Shift+Letter:".localized, bottomDivider: true) {
Picker(
"",
selection: $selUpperCaseLetterKeyBehavior.onChange {
PrefMgr.shared.upperCaseLetterKeyBehavior = selUpperCaseLetterKeyBehavior
}
selection: $upperCaseLetterKeyBehavior
) {
Text(LocalizedStringKey("Type them into inline composition buffer")).tag(0)
Text(LocalizedStringKey("Directly commit lowercased letters")).tag(1)
@ -159,9 +161,7 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "Intonation Key:".localized, bottomDivider: true) {
Picker(
"",
selection: $selSpecifyIntonationKeyBehavior.onChange {
PrefMgr.shared.specifyIntonationKeyBehavior = selSpecifyIntonationKeyBehavior
}
selection: $specifyIntonationKeyBehavior
) {
Text(LocalizedStringKey("Override the previous reading's intonation with candidate-reset")).tag(0)
Text(LocalizedStringKey("Only override the intonation of the previous reading if different")).tag(1)
@ -175,23 +175,21 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "Shift:", bottomDivider: true) {
Toggle(
LocalizedStringKey("Toggle alphanumerical mode with Left-Shift"),
isOn: $selTogglingAlphanumericalModeWithLShift.onChange {
PrefMgr.shared.togglingAlphanumericalModeWithLShift = selTogglingAlphanumericalModeWithLShift
isOn: $togglingAlphanumericalModeWithLShift.onChange {
SessionCtl.theShiftKeyDetector.toggleWithLShift = togglingAlphanumericalModeWithLShift
}
)
Toggle(
LocalizedStringKey("Toggle alphanumerical mode with Right-Shift"),
isOn: $selTogglingAlphanumericalModeWithRShift.onChange {
PrefMgr.shared.togglingAlphanumericalModeWithRShift = selTogglingAlphanumericalModeWithRShift
isOn: $togglingAlphanumericalModeWithRShift.onChange {
SessionCtl.theShiftKeyDetector.toggleWithRShift = togglingAlphanumericalModeWithRShift
}
)
Toggle(
LocalizedStringKey("Share alphanumerical mode status across all clients"),
isOn: $selShareAlphanumericalModeStatusAcrossClients.onChange {
PrefMgr.shared.shareAlphanumericalModeStatusAcrossClients = selShareAlphanumericalModeStatusAcrossClients
}
isOn: $shareAlphanumericalModeStatusAcrossClients
).disabled(
!PrefMgr.shared.togglingAlphanumericalModeWithRShift && !PrefMgr.shared.togglingAlphanumericalModeWithLShift
!togglingAlphanumericalModeWithRShift && !togglingAlphanumericalModeWithLShift
)
Text(
"This feature requires macOS 10.15 and above.".localized + CtlPrefUIShared.sentenceSeparator
@ -201,20 +199,20 @@ struct VwrPrefPaneBehavior: View {
SSPreferences.Section(title: "Caps Lock:", bottomDivider: true) {
Toggle(
LocalizedStringKey("Show notifications when toggling Caps Lock"),
isOn: $selShowNotificationsWhenTogglingCapsLock.onChange {
PrefMgr.shared.showNotificationsWhenTogglingCapsLock = selShowNotificationsWhenTogglingCapsLock
isOn: $showNotificationsWhenTogglingCapsLock.onChange {
if !macOSMontereyOrLaterDetected, showNotificationsWhenTogglingCapsLock {
showNotificationsWhenTogglingCapsLock.toggle()
}
}
).disabled(!macOSMontereyOrLaterDetected)
Text(
"This feature requires macOS 10.15 and above.".localized
"This feature requires macOS 12 and above.".localized
).preferenceDescription()
}
SSPreferences.Section(title: "Misc Settings:".localized) {
Toggle(
LocalizedStringKey("Always show tooltip texts horizontally"),
isOn: $selAlwaysShowTooltipTextsHorizontally.onChange {
PrefMgr.shared.alwaysShowTooltipTextsHorizontally = selAlwaysShowTooltipTextsHorizontally
}
isOn: $alwaysShowTooltipTextsHorizontally
).disabled(Bundle.main.preferredLocalizations[0] == "en")
Text(
LocalizedStringKey(

View File

@ -10,39 +10,46 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneCandidates: View {
@State private var selCandidateUIFontSize = UserDefaults.standard.integer(
forKey: UserDef.kCandidateListTextSize.rawValue)
@State private var selEnableHorizontalCandidateLayout = UserDefaults.standard.bool(
forKey: UserDef.kUseHorizontalCandidateList.rawValue)
@State private var selCandidateWindowShowOnlyOneLine = UserDefaults.standard.bool(
forKey: UserDef.kCandidateWindowShowOnlyOneLine.rawValue)
@State private var selShowReverseLookupInCandidateUI = UserDefaults.standard.bool(
forKey: UserDef.kShowReverseLookupInCandidateUI.rawValue)
@State private var selCursorPosition =
UserDefaults.standard.bool(
forKey: UserDef.kUseRearCursorMode.rawValue) ? 1 : 0
@State private var selPushCursorAfterSelection = UserDefaults.standard.bool(
forKey: UserDef.kMoveCursorAfterSelectingCandidate.rawValue)
@State private var selUseFixecCandidateOrderOnSelection: Bool = UserDefaults.standard.bool(
forKey: UserDef.kUseFixecCandidateOrderOnSelection.rawValue)
@State private var selConsolidateContextOnCandidateSelection: Bool = UserDefaults.standard.bool(
forKey: UserDef.kConsolidateContextOnCandidateSelection.rawValue)
@State private var selUseIMKCandidateWindow: Bool = UserDefaults.standard.bool(
forKey: UserDef.kUseIMKCandidateWindow.rawValue)
@State private var selEnableMouseScrollingForTDKCandidatesCocoa: Bool = UserDefaults.standard.bool(
forKey: UserDef.kEnableMouseScrollingForTDKCandidatesCocoa.rawValue)
@State private var selEnableSwiftUIForTDKCandidates: Bool = UserDefaults.standard.bool(
forKey: UserDef.kEnableSwiftUIForTDKCandidates.rawValue)
// MARK: - AppStorage Variables
var isMontereyOrAbove: Bool = {
if #available(macOS 12.0, *) {
return true
}
return false
}()
@Backport.AppStorage(wrappedValue: 16, UserDef.kCandidateListTextSize.rawValue)
private var candidateListTextSize: Double
@Backport.AppStorage(wrappedValue: true, UserDef.kUseHorizontalCandidateList.rawValue)
private var useHorizontalCandidateList: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kCandidateWindowShowOnlyOneLine.rawValue)
private var candidateWindowShowOnlyOneLine: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kShowReverseLookupInCandidateUI.rawValue)
private var showReverseLookupInCandidateUI: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kUseRearCursorMode.rawValue)
private var useRearCursorMode: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kMoveCursorAfterSelectingCandidate.rawValue)
private var moveCursorAfterSelectingCandidate: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kUseFixecCandidateOrderOnSelection.rawValue)
private var useFixecCandidateOrderOnSelection: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kConsolidateContextOnCandidateSelection.rawValue)
private var consolidateContextOnCandidateSelection: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kUseIMKCandidateWindow.rawValue)
private var useIMKCandidateWindow: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kEnableSwiftUIForTDKCandidates.rawValue)
private var enableSwiftUIForTDKCandidates: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kEnableMouseScrollingForTDKCandidatesCocoa.rawValue)
private var enableMouseScrollingForTDKCandidatesCocoa: Bool
// MARK: - Main View
var body: some View {
ScrollView {
@ -53,9 +60,7 @@ struct VwrPrefPaneCandidates: View {
SSPreferences.Section(title: "Candidate Layout:".localized, bottomDivider: true) {
Picker(
"",
selection: $selEnableHorizontalCandidateLayout.onChange {
PrefMgr.shared.useHorizontalCandidateList = selEnableHorizontalCandidateLayout
}
selection: $useHorizontalCandidateList
) {
Text(LocalizedStringKey("Vertical")).tag(false)
Text(LocalizedStringKey("Horizontal")).tag(true)
@ -67,13 +72,10 @@ struct VwrPrefPaneCandidates: View {
.preferenceDescription()
Toggle(
LocalizedStringKey("Use only one row / column in candidate window."),
isOn: $selCandidateWindowShowOnlyOneLine.onChange {
PrefMgr.shared.candidateWindowShowOnlyOneLine =
selCandidateWindowShowOnlyOneLine
}
isOn: $candidateWindowShowOnlyOneLine
)
.controlSize(.small)
.disabled(PrefMgr.shared.useIMKCandidateWindow)
.disabled(useIMKCandidateWindow)
Text(
"This only works with Tadokoro candidate window.".localized
+ CtlPrefUIShared.sentenceSeparator
@ -84,24 +86,25 @@ struct VwrPrefPaneCandidates: View {
SSPreferences.Section(title: "Candidate Size:".localized, bottomDivider: true) {
Picker(
"",
selection: $selCandidateUIFontSize.onChange {
PrefMgr.shared.candidateListTextSize = Double(selCandidateUIFontSize)
selection: $candidateListTextSize.onChange {
guard !(12 ... 196).contains(candidateListTextSize) else { return }
candidateListTextSize = max(12, min(candidateListTextSize, 196))
}
) {
Group {
Text("12").tag(12)
Text("14").tag(14)
Text("16").tag(16)
Text("17").tag(17)
Text("18").tag(18)
Text("20").tag(20)
Text("22").tag(22)
Text("24").tag(24)
Text("12").tag(12.0)
Text("14").tag(14.0)
Text("16").tag(16.0)
Text("17").tag(17.0)
Text("18").tag(18.0)
Text("20").tag(20.0)
Text("22").tag(22.0)
Text("24").tag(24.0)
}
Group {
Text("32").tag(32)
Text("64").tag(64)
Text("96").tag(96)
Text("32").tag(32.0)
Text("64").tag(64.0)
Text("96").tag(96.0)
}
}
.labelsHidden()
@ -112,12 +115,10 @@ struct VwrPrefPaneCandidates: View {
SSPreferences.Section(title: "Cursor Selection:".localized, bottomDivider: true) {
Picker(
"",
selection: $selCursorPosition.onChange {
PrefMgr.shared.useRearCursorMode = (selCursorPosition == 1) ? true : false
}
selection: $useRearCursorMode
) {
Text(LocalizedStringKey("in front of the phrase (like macOS built-in Zhuyin IME)")).tag(0)
Text(LocalizedStringKey("at the rear of the phrase (like Microsoft New Phonetic)")).tag(1)
Text(LocalizedStringKey("in front of the phrase (like macOS built-in Zhuyin IME)")).tag(false)
Text(LocalizedStringKey("at the rear of the phrase (like Microsoft New Phonetic)")).tag(true)
}
.labelsHidden()
.pickerStyle(RadioGroupPickerStyle())
@ -125,19 +126,15 @@ struct VwrPrefPaneCandidates: View {
.preferenceDescription()
Toggle(
LocalizedStringKey("Push the cursor in front of the phrase after selection"),
isOn: $selPushCursorAfterSelection.onChange {
PrefMgr.shared.moveCursorAfterSelectingCandidate = selPushCursorAfterSelection
}
isOn: $moveCursorAfterSelectingCandidate
).controlSize(.small)
}
SSPreferences.Section(title: "Misc Settings:".localized, bottomDivider: true) {
Toggle(
LocalizedStringKey("Show available reverse-lookup results in candidate window"),
isOn: $selShowReverseLookupInCandidateUI.onChange {
PrefMgr.shared.showReverseLookupInCandidateUI = selShowReverseLookupInCandidateUI
}
isOn: $showReverseLookupInCandidateUI
)
.disabled(PrefMgr.shared.useIMKCandidateWindow)
.disabled(useIMKCandidateWindow)
Text(
"This only works with Tadokoro candidate window.".localized
+ CtlPrefUIShared.sentenceSeparator
@ -146,9 +143,7 @@ struct VwrPrefPaneCandidates: View {
.preferenceDescription()
Toggle(
LocalizedStringKey("Always use fixed listing order in candidate window"),
isOn: $selUseFixecCandidateOrderOnSelection.onChange {
PrefMgr.shared.useFixecCandidateOrderOnSelection = selUseFixecCandidateOrderOnSelection
}
isOn: $useFixecCandidateOrderOnSelection
)
Text(
LocalizedStringKey(
@ -158,9 +153,7 @@ struct VwrPrefPaneCandidates: View {
.preferenceDescription()
Toggle(
LocalizedStringKey("Consolidate the context on confirming candidate selection"),
isOn: $selConsolidateContextOnCandidateSelection.onChange {
PrefMgr.shared.consolidateContextOnCandidateSelection = selConsolidateContextOnCandidateSelection
}
isOn: $consolidateContextOnCandidateSelection
)
Text(
"For example: When typing “章太炎” and you want to override the “太” with “泰”, and the raw operation index range [1,2) which bounds are cutting the current node “章太炎” in range [0,3). If having lack of the pre-consolidation process, this word will become something like “張泰言” after the candidate selection. Only if we enable this consolidation, this word will become “章泰炎” which is the expected result that the context is kept as-is.".localized
@ -170,8 +163,7 @@ struct VwrPrefPaneCandidates: View {
SSPreferences.Section(title: "Experimental:".localized) {
Toggle(
LocalizedStringKey("Use IMK Candidate Window instead of Tadokoro"),
isOn: $selUseIMKCandidateWindow.onChange {
PrefMgr.shared.useIMKCandidateWindow = selUseIMKCandidateWindow
isOn: $useIMKCandidateWindow.onChange {
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
NSApp.terminate(nil)
}
@ -186,22 +178,16 @@ struct VwrPrefPaneCandidates: View {
.preferenceDescription()
Toggle(
LocalizedStringKey("Enable mouse wheel support for Tadokoro Candidate Window"),
isOn: $selEnableMouseScrollingForTDKCandidatesCocoa.onChange {
PrefMgr.shared.enableMouseScrollingForTDKCandidatesCocoa =
selEnableMouseScrollingForTDKCandidatesCocoa
}
isOn: $enableMouseScrollingForTDKCandidatesCocoa
)
.disabled(
PrefMgr.shared.useIMKCandidateWindow || PrefMgr.shared.enableSwiftUIForTDKCandidates
useIMKCandidateWindow || enableSwiftUIForTDKCandidates
)
Toggle(
LocalizedStringKey("Enable experimental Swift UI typesetting method"),
isOn: $selEnableSwiftUIForTDKCandidates.onChange {
PrefMgr.shared.enableSwiftUIForTDKCandidates =
selEnableSwiftUIForTDKCandidates
}
isOn: $enableSwiftUIForTDKCandidates
)
.disabled(PrefMgr.shared.useIMKCandidateWindow)
.disabled(useIMKCandidateWindow)
Text(
"By checking this, Tadokoro Candidate Window will use SwiftUI. SwiftUI was being used in vChewing 3.3.8 and before. However, SwiftUI has unacceptable responsiveness & latency & efficiency problems in rendering the candidate panel UI. That's why a refactored version has been introduced since vChewing 3.3.9 using Cocoa, providing an optimized user experience with blasing-fast operation responsiveness, plus experimental mouse-wheel support.".localized
)
@ -224,40 +210,35 @@ struct VwrPrefPaneCandidates_Previews: PreviewProvider {
@available(macOS 10.15, *)
private struct VwrPrefPaneCandidates_SelectionKeys: View {
@State private var selSelectionKeysList = CandidateKey.suggestions
@State private var selSelectionKeys =
UserDefaults.standard.string(forKey: UserDef.kCandidateKeys.rawValue) ?? CandidateKey.defaultKeys
// MARK: - AppStorage Variables
@Backport.AppStorage(wrappedValue: PrefMgr.kDefaultCandidateKeys, UserDef.kCandidateKeys.rawValue)
private var candidateKeys: String
@Backport.AppStorage(wrappedValue: false, UserDef.kUseIMKCandidateWindow.rawValue)
private var useIMKCandidateWindow: Bool
// MARK: - Main View
var body: some View {
ComboBox(
items: CandidateKey.suggestions,
text: $selSelectionKeys.onChange {
let value = selSelectionKeys
text: $candidateKeys.onChange {
let value = candidateKeys
let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicated
if keys.isEmpty {
selSelectionKeys = PrefMgr.shared.candidateKeys
return
}
// Start Error Handling.
if let errorResult = CandidateKey.validate(keys: keys) {
IMEApp.buzz()
if let window = CtlPrefUIShared.sharedWindow {
if let window = CtlPrefUIShared.sharedWindow, !keys.isEmpty {
IMEApp.buzz()
let alert = NSAlert(error: NSLocalizedString("Invalid Selection Keys.", comment: ""))
alert.informativeText = errorResult
alert.beginSheetModal(for: window) { _ in
selSelectionKeys = PrefMgr.shared.candidateKeys
}
} else {
selSelectionKeys = PrefMgr.shared.candidateKeys
alert.beginSheetModal(for: window)
}
} else {
PrefMgr.shared.candidateKeys = keys
selSelectionKeys = PrefMgr.shared.candidateKeys
return
candidateKeys = PrefMgr.kDefaultCandidateKeys
}
}
).frame(width: 180).disabled(PrefMgr.shared.useIMKCandidateWindow)
if PrefMgr.shared.useIMKCandidateWindow {
).frame(width: 180).disabled(useIMKCandidateWindow)
if useIMKCandidateWindow {
Text(
LocalizedStringKey(
"⚠︎ This feature in IMK Candidate Window defects. Please consult\nApple Developer Relations with Radar ID: #FB11300759."

View File

@ -11,21 +11,30 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneCassette: View {
// MARK: - AppStorage Variables
@Backport.AppStorage(wrappedValue: "", UserDef.kCassettePath.rawValue)
private var cassettePath: String
@Backport.AppStorage(wrappedValue: false, UserDef.kCassetteEnabled.rawValue)
private var cassetteEnabled: Bool
@Backport.AppStorage(wrappedValue: 0, UserDef.kForceCassetteChineseConversion.rawValue)
private var forceCassetteChineseConversion: Int
@Backport.AppStorage(wrappedValue: true, UserDef.kShowTranslatedStrokesInCompositionBuffer.rawValue)
private var showTranslatedStrokesInCompositionBuffer: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kAutoCompositeWithLongestPossibleCassetteKey.rawValue)
private var autoCompositeWithLongestPossibleCassetteKey: Bool
// MARK: - Main View
private var fdrCassetteDataDefault: String { "" }
@State private var tbxCassettePath: String =
UserDefaults.standard.string(forKey: UserDef.kCassettePath.rawValue)
?? ""
@State private var selCassetteEnabled: Bool = UserDefaults.standard.bool(
forKey: UserDef.kCassetteEnabled.rawValue)
@State private var selForceCassetteChineseConversion: Int = UserDefaults.standard.integer(
forKey: UserDef.kForceCassetteChineseConversion.rawValue)
@State private var selShowTranslatedStrokesInCompositionBuffer: Bool = UserDefaults.standard.bool(
forKey: UserDef.kShowTranslatedStrokesInCompositionBuffer.rawValue)
@State private var selAutoCompositeWithLongestPossibleCassetteKey = UserDefaults.standard.bool(
forKey: UserDef.kAutoCompositeWithLongestPossibleCassetteKey.rawValue)
private static let dlgOpenFile = NSOpenPanel()
@ -37,8 +46,8 @@ struct VwrPrefPaneCassette: View {
SSPreferences.Section(bottomDivider: true) {
Text(LocalizedStringKey("Choose your desired cassette file path. Will be omitted if invalid."))
HStack {
TextField(fdrCassetteDataDefault, text: $tbxCassettePath).disabled(true)
.help(tbxCassettePath)
TextField(fdrCassetteDataDefault, text: $cassettePath).disabled(true)
.help(cassettePath)
Button {
Self.dlgOpenFile.title = NSLocalizedString(
"Choose your desired cassette file path.", comment: ""
@ -52,16 +61,15 @@ struct VwrPrefPaneCassette: View {
Self.dlgOpenFile.allowsOtherFileTypes = true
let bolPreviousPathValidity = LMMgr.checkCassettePathValidity(
PrefMgr.shared.cassettePath.expandingTildeInPath)
cassettePath.expandingTildeInPath)
if let window = CtlPrefUIShared.sharedWindow {
Self.dlgOpenFile.beginSheetModal(for: window) { result in
if result == NSApplication.ModalResponse.OK {
guard let url = Self.dlgOpenFile.url else { return }
if LMMgr.checkCassettePathValidity(url.path) {
PrefMgr.shared.cassettePath = url.path
cassettePath = url.path
LMMgr.loadCassetteData()
tbxCassettePath = PrefMgr.shared.cassettePath
BookmarkManager.shared.saveBookmark(for: url)
} else {
IMEApp.buzz()
@ -83,15 +91,14 @@ struct VwrPrefPaneCassette: View {
}
Button {
LMMgr.resetCassettePath()
tbxCassettePath = ""
} label: {
Text("×")
}
}
Toggle(
LocalizedStringKey("Enable cassette mode, suppressing phonabet input"),
isOn: $selCassetteEnabled.onChange {
if selCassetteEnabled, !LMMgr.checkCassettePathValidity(PrefMgr.shared.cassettePath) {
isOn: $cassetteEnabled.onChange {
if cassetteEnabled, !LMMgr.checkCassettePathValidity(cassettePath) {
if let window = CtlPrefUIShared.sharedWindow {
IMEApp.buzz()
let alert = NSAlert(error: NSLocalizedString("Path invalid or file access error.", comment: ""))
@ -99,15 +106,14 @@ struct VwrPrefPaneCassette: View {
"Please reconfigure the cassette path to a valid one before enabling this mode.", comment: ""
)
alert.beginSheetModal(for: window) { _ in
LMMgr.resetCassettePath()
PrefMgr.shared.cassetteEnabled = false
selCassetteEnabled = false
}
}
LMMgr.resetCassettePath()
cassetteEnabled = false
} else {
PrefMgr.shared.cassetteEnabled = selCassetteEnabled
LMMgr.loadCassetteData()
}
LMMgr.setCassetteEnabled(cassetteEnabled)
}
).controlSize(.small)
Text(
@ -123,16 +129,11 @@ struct VwrPrefPaneCassette: View {
SSPreferences.Section {
Toggle(
LocalizedStringKey("Auto-composite when the longest possible key is formed"),
isOn: $selAutoCompositeWithLongestPossibleCassetteKey.onChange {
PrefMgr.shared.autoCompositeWithLongestPossibleCassetteKey =
selAutoCompositeWithLongestPossibleCassetteKey
}
isOn: $autoCompositeWithLongestPossibleCassetteKey
)
Toggle(
LocalizedStringKey("Show translated strokes in composition buffer"),
isOn: $selShowTranslatedStrokesInCompositionBuffer.onChange {
PrefMgr.shared.showTranslatedStrokesInCompositionBuffer = selShowTranslatedStrokesInCompositionBuffer
}
isOn: $showTranslatedStrokesInCompositionBuffer
)
Text(
LocalizedStringKey(
@ -142,9 +143,7 @@ struct VwrPrefPaneCassette: View {
.preferenceDescription()
Picker(
"",
selection: $selForceCassetteChineseConversion.onChange {
PrefMgr.shared.forceCassetteChineseConversion = selForceCassetteChineseConversion
}
selection: $forceCassetteChineseConversion
) {
Text(LocalizedStringKey("Disable forced conversion for cassette outputs")).tag(0)
Text(LocalizedStringKey("Enforce conversion in both input modes")).tag(1)

View File

@ -10,20 +10,19 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneDevZone: View {
@State private var selDisableSegmentedThickUnderlineInMarkingModeForManagedClients
= UserDefaults.standard.bool(
forKey: UserDef.kDisableSegmentedThickUnderlineInMarkingModeForManagedClients.rawValue
)
// MARK: - AppStorage Variables
var isMontereyOrAbove: Bool = {
if #available(macOS 12.0, *) {
return true
}
return false
}()
@Backport.AppStorage(
wrappedValue: false,
UserDef.kDisableSegmentedThickUnderlineInMarkingModeForManagedClients.rawValue
)
private var disableSegmentedThickUnderlineInMarkingModeForManagedClients: Bool
// MARK: - Main View
var body: some View {
ScrollView {
@ -41,9 +40,7 @@ struct VwrPrefPaneDevZone: View {
}
Toggle(
"Disable segmented thick underline in marking mode for managed clients".localized,
isOn: $selDisableSegmentedThickUnderlineInMarkingModeForManagedClients.onChange {
PrefMgr.shared.disableSegmentedThickUnderlineInMarkingModeForManagedClients = selDisableSegmentedThickUnderlineInMarkingModeForManagedClients
}
isOn: $disableSegmentedThickUnderlineInMarkingModeForManagedClients
)
Text(
"Some clients with web-based front UI may have issues rendering segmented thick underlines drawn by their implemented “setMarkedText()”. This option stops the input method from delivering segmented thick underlines to “client().setMarkedText()”. Note that segmented thick underlines are only used in marking mode, unless the client itself misimplements the IMKTextInput method “setMarkedText()”. This option only affects the inline composition buffer.".localized

View File

@ -11,29 +11,42 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneDictionary: View {
// MARK: - AppStorage Variables
@Backport.AppStorage(wrappedValue: "", UserDef.kUserDataFolderSpecified.rawValue)
private var userDataFolderSpecified: String
@Backport.AppStorage(wrappedValue: true, UserDef.kShouldAutoReloadUserDataFiles.rawValue)
private var shouldAutoReloadUserDataFiles: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kUseExternalFactoryDict.rawValue)
private var useExternalFactoryDict: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kOnlyLoadFactoryLangModelsIfNeeded.rawValue)
private var onlyLoadFactoryLangModelsIfNeeded: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kCNS11643Enabled.rawValue)
private var cns11643Enabled: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kSymbolInputEnabled.rawValue)
private var symbolInputEnabled: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kFetchSuggestionsFromUserOverrideModel.rawValue)
private var fetchSuggestionsFromUserOverrideModel: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kPhraseReplacementEnabled.rawValue)
private var phraseReplacementEnabled: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kAllowBoostingSingleKanjiAsUserPhrase.rawValue)
private var allowBoostingSingleKanjiAsUserPhrase: Bool
// MARK: - Main View
private var fdrUserDataDefault: String { LMMgr.dataFolderPath(isDefaultFolder: true) }
@State private var tbxUserDataPathSpecified: String =
UserDefaults.standard.string(forKey: UserDef.kUserDataFolderSpecified.rawValue)
?? LMMgr.dataFolderPath(isDefaultFolder: true)
@State private var selAutoReloadUserData: Bool = UserDefaults.standard.bool(
forKey: UserDef.kShouldAutoReloadUserDataFiles.rawValue)
@State private var selUseExternalFactoryDict: Bool = UserDefaults.standard.bool(
forKey: UserDef.kUseExternalFactoryDict.rawValue)
@State private var selOnlyLoadFactoryLangModelsIfNeeded: Bool = UserDefaults.standard.bool(
forKey: UserDef.kOnlyLoadFactoryLangModelsIfNeeded.rawValue)
@State private var selEnableCNS11643: Bool = UserDefaults.standard.bool(forKey: UserDef.kCNS11643Enabled.rawValue)
@State private var selEnableSymbolInputSupport: Bool = UserDefaults.standard.bool(
forKey: UserDef.kSymbolInputEnabled.rawValue)
@State private var selFetchSuggestionsFromUserOverrideModel: Bool = UserDefaults.standard.bool(
forKey: UserDef.kFetchSuggestionsFromUserOverrideModel.rawValue)
@State private var selPhraseReplacementEnabled: Bool = UserDefaults.standard.bool(
forKey: UserDef.kPhraseReplacementEnabled.rawValue
)
@State private var selAllowBoostingSingleKanjiAsUserPhrase: Bool = UserDefaults.standard.bool(
forKey: UserDef.kAllowBoostingSingleKanjiAsUserPhrase.rawValue)
private static let dlgOpenPath = NSOpenPanel()
private static let dlgOpenFile = NSOpenPanel()
@ -47,8 +60,8 @@ struct VwrPrefPaneDictionary: View {
Group {
Text(LocalizedStringKey("Choose your desired user data folder path. Will be omitted if invalid."))
HStack {
TextField(fdrUserDataDefault, text: $tbxUserDataPathSpecified).disabled(true)
.help(tbxUserDataPathSpecified)
TextField(fdrUserDataDefault, text: $userDataFolderSpecified).disabled(true)
.help(userDataFolderSpecified)
Button {
Self.dlgOpenPath.title = NSLocalizedString(
"Choose your desired user data folder.", comment: ""
@ -60,7 +73,7 @@ struct VwrPrefPaneDictionary: View {
Self.dlgOpenPath.canChooseDirectories = true
let bolPreviousFolderValidity = LMMgr.checkIfSpecifiedUserDataFolderValid(
PrefMgr.shared.userDataFolderSpecified.expandingTildeInPath)
userDataFolderSpecified.expandingTildeInPath)
if let window = CtlPrefUIShared.sharedWindow {
Self.dlgOpenPath.beginSheetModal(for: window) { result in
@ -71,8 +84,7 @@ struct VwrPrefPaneDictionary: View {
var newPath = url.path
newPath.ensureTrailingSlash()
if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) {
PrefMgr.shared.userDataFolderSpecified = newPath
tbxUserDataPathSpecified = PrefMgr.shared.userDataFolderSpecified
userDataFolderSpecified = newPath
BookmarkManager.shared.saveBookmark(for: url)
(NSApp.delegate as? AppDelegate)?.updateDirectoryMonitorPath()
} else {
@ -94,17 +106,16 @@ struct VwrPrefPaneDictionary: View {
Text("...")
}
Button {
userDataFolderSpecified = ""
LMMgr.resetSpecifiedUserDataFolder()
tbxUserDataPathSpecified = ""
} label: {
Text("")
}
}
Toggle(
LocalizedStringKey("Automatically reload user data files if changes detected"),
isOn: $selAutoReloadUserData.onChange {
PrefMgr.shared.shouldAutoReloadUserDataFiles = selAutoReloadUserData
if selAutoReloadUserData {
isOn: $shouldAutoReloadUserDataFiles.onChange {
if shouldAutoReloadUserDataFiles {
LMMgr.initUserLangModels()
}
}
@ -120,8 +131,7 @@ struct VwrPrefPaneDictionary: View {
Group {
Toggle(
LocalizedStringKey("Read external factory dictionary plists if possible"),
isOn: $selUseExternalFactoryDict.onChange {
PrefMgr.shared.useExternalFactoryDict = selUseExternalFactoryDict
isOn: $useExternalFactoryDict.onChange {
LMMgr.reloadFactoryDictionaryPlists()
}
)
@ -133,29 +143,25 @@ struct VwrPrefPaneDictionary: View {
.preferenceDescription()
Toggle(
LocalizedStringKey("Only load factory language models if needed"),
isOn: $selOnlyLoadFactoryLangModelsIfNeeded.onChange {
PrefMgr.shared.onlyLoadFactoryLangModelsIfNeeded = selOnlyLoadFactoryLangModelsIfNeeded
isOn: $onlyLoadFactoryLangModelsIfNeeded.onChange {
if !onlyLoadFactoryLangModelsIfNeeded { LMMgr.loadDataModelsOnAppDelegate() }
}
)
Toggle(
LocalizedStringKey("Enable CNS11643 Support (2023-01-06)"),
isOn: $selEnableCNS11643.onChange {
PrefMgr.shared.cns11643Enabled = selEnableCNS11643
LMMgr.setCNSEnabled(PrefMgr.shared.cns11643Enabled)
isOn: $cns11643Enabled.onChange {
LMMgr.setCNSEnabled(cns11643Enabled)
}
)
Toggle(
LocalizedStringKey("Enable symbol input support (incl. certain emoji symbols)"),
isOn: $selEnableSymbolInputSupport.onChange {
PrefMgr.shared.symbolInputEnabled = selEnableSymbolInputSupport
LMMgr.setSymbolEnabled(PrefMgr.shared.symbolInputEnabled)
isOn: $symbolInputEnabled.onChange {
LMMgr.setSymbolEnabled(symbolInputEnabled)
}
)
Toggle(
LocalizedStringKey("Applying typing suggestions from half-life user override model"),
isOn: $selFetchSuggestionsFromUserOverrideModel.onChange {
PrefMgr.shared.fetchSuggestionsFromUserOverrideModel = selFetchSuggestionsFromUserOverrideModel
}
isOn: $fetchSuggestionsFromUserOverrideModel
)
Text(
"The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu.".localized
@ -163,8 +169,11 @@ struct VwrPrefPaneDictionary: View {
.preferenceDescription()
Toggle(
LocalizedStringKey("Enable phrase replacement table"),
isOn: $selPhraseReplacementEnabled.onChange {
PrefMgr.shared.phraseReplacementEnabled = selPhraseReplacementEnabled
isOn: $phraseReplacementEnabled.onChange {
LMMgr.setPhraseReplacementEnabled(phraseReplacementEnabled)
if phraseReplacementEnabled {
LMMgr.loadUserPhraseReplacement()
}
}
)
Text("This will batch-replace specified candidates.".localized).preferenceDescription()
@ -173,9 +182,7 @@ struct VwrPrefPaneDictionary: View {
Group {
Toggle(
LocalizedStringKey("Allow boosting / excluding a candidate of single kanji when marking"),
isOn: $selAllowBoostingSingleKanjiAsUserPhrase.onChange {
PrefMgr.shared.allowBoostingSingleKanjiAsUserPhrase = selAllowBoostingSingleKanjiAsUserPhrase
}
isOn: $allowBoostingSingleKanjiAsUserPhrase
)
Text(
LocalizedStringKey(

View File

@ -10,30 +10,63 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneGeneral: View {
@State private var selUILanguage: [String] =
Shared.arrSupportedLocales.contains(
((UserDefaults.standard.object(forKey: UserDef.kAppleLanguages.rawValue) == nil)
? ["auto"] : UserDefaults.standard.array(forKey: UserDef.kAppleLanguages.rawValue) as? [String] ?? ["auto"])[0])
? ((UserDefaults.standard.object(forKey: UserDef.kAppleLanguages.rawValue) == nil)
? ["auto"] : UserDefaults.standard.array(forKey: UserDef.kAppleLanguages.rawValue) as? [String] ?? ["auto"])
: ["auto"]
@State private var selAutoCorrectReadingCombination = UserDefaults.standard.bool(
forKey: UserDef.kAutoCorrectReadingCombination.rawValue)
@State private var selShowHanyuPinyinInCompositionBuffer = UserDefaults.standard.bool(
forKey: UserDef.kShowHanyuPinyinInCompositionBuffer.rawValue)
@State private var selKeepReadingUponCompositionError = UserDefaults.standard.bool(
forKey: UserDef.kKeepReadingUponCompositionError.rawValue)
@State private var selClassicHaninKeyboardSymbolModeShortcutEnabled = UserDefaults.standard.bool(
forKey: UserDef.kClassicHaninKeyboardSymbolModeShortcutEnabled.rawValue)
@State private var selEnableSCPCTypingMode = UserDefaults.standard.bool(forKey: UserDef.kUseSCPCTypingMode.rawValue)
@State private var selEnableFartSuppressor = UserDefaults.standard.bool(
forKey: UserDef.kShouldNotFartInLieuOfBeep.rawValue)
@State private var selEnableAutoUpdateCheck = UserDefaults.standard.bool(
forKey: UserDef.kCheckUpdateAutomatically.rawValue)
@State private var selEnableDebugMode = UserDefaults.standard.bool(forKey: UserDef.kIsDebugModeEnabled.rawValue)
@Binding var appleLanguageTag: String
init() {
_appleLanguageTag = .init(
get: {
let loadedValue = (UserDefaults.standard.array(forKey: UserDef.kAppleLanguages.rawValue) as? [String] ?? ["auto"]).joined()
let plistValueNotExist = (UserDefaults.standard.object(forKey: UserDef.kAppleLanguages.rawValue) == nil)
let targetToCheck = (plistValueNotExist || loadedValue.isEmpty) ? "auto" : loadedValue
return Shared.arrSupportedLocales.contains(targetToCheck) ? (plistValueNotExist ? "auto" : loadedValue) : "auto"
}, set: { newValue in
var newValue = newValue
if newValue.isEmpty || newValue == "auto" {
UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue)
}
if newValue == "auto" { newValue = "" }
guard PrefMgr.shared.appleLanguages.joined() != newValue else { return }
if !newValue.isEmpty { PrefMgr.shared.appleLanguages = [newValue] }
NSLog("vChewing App self-terminated due to UI language change.")
NSApp.terminate(nil)
}
)
}
// MARK: - AppStorage Variables
@Backport.AppStorage(wrappedValue: [], UserDef.kAppleLanguages.rawValue)
private var appleLanguages: [String]
@Backport.AppStorage(wrappedValue: true, UserDef.kAutoCorrectReadingCombination.rawValue)
private var autoCorrectReadingCombination: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kKeepReadingUponCompositionError.rawValue)
private var keepReadingUponCompositionError: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kShowHanyuPinyinInCompositionBuffer.rawValue)
private var showHanyuPinyinInCompositionBuffer: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kClassicHaninKeyboardSymbolModeShortcutEnabled.rawValue)
private var classicHaninKeyboardSymbolModeShortcutEnabled: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kUseSCPCTypingMode.rawValue)
private var useSCPCTypingMode: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kShouldNotFartInLieuOfBeep.rawValue)
private var shouldNotFartInLieuOfBeep: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kCheckUpdateAutomatically.rawValue)
private var checkUpdateAutomatically: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kIsDebugModeEnabled.rawValue)
private var isDebugModeEnabled: Bool
// MARK: - Main View
var body: some View {
ScrollView {
@ -56,28 +89,13 @@ struct VwrPrefPaneGeneral: View {
HStack {
Picker(
LocalizedStringKey("Follow OS settings"),
selection: $selUILanguage.onChange {
vCLog(selUILanguage[0])
if selUILanguage == PrefMgr.shared.appleLanguages
|| (selUILanguage[0] == "auto"
&& UserDefaults.standard.object(forKey: UserDef.kAppleLanguages.rawValue) == nil)
{
return
}
if selUILanguage[0] != "auto" {
PrefMgr.shared.appleLanguages = selUILanguage
} else {
UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue)
}
NSLog("vChewing App self-terminated due to UI language change.")
NSApp.terminate(nil)
}
selection: $appleLanguageTag
) {
Text(LocalizedStringKey("Follow OS settings")).tag(["auto"])
Text(LocalizedStringKey("Simplified Chinese")).tag(["zh-Hans"])
Text(LocalizedStringKey("Traditional Chinese")).tag(["zh-Hant"])
Text(LocalizedStringKey("Japanese")).tag(["ja"])
Text(LocalizedStringKey("English")).tag(["en"])
Text(LocalizedStringKey("Follow OS settings")).tag("auto")
Text(LocalizedStringKey("Simplified Chinese")).tag("zh-Hans")
Text(LocalizedStringKey("Traditional Chinese")).tag("zh-Hant")
Text(LocalizedStringKey("Japanese")).tag("ja")
Text(LocalizedStringKey("English")).tag("en")
}
.labelsHidden()
.frame(width: 180.0)
@ -89,33 +107,25 @@ struct VwrPrefPaneGeneral: View {
SSPreferences.Section(label: { Text(LocalizedStringKey("Typing Settings:")) }) {
Toggle(
LocalizedStringKey("Automatically correct reading combinations when typing"),
isOn: $selAutoCorrectReadingCombination.onChange {
PrefMgr.shared.autoCorrectReadingCombination = selAutoCorrectReadingCombination
}
isOn: $autoCorrectReadingCombination
)
Toggle(
LocalizedStringKey("Show Hanyu-Pinyin in the inline composition buffer"),
isOn: $selShowHanyuPinyinInCompositionBuffer.onChange {
PrefMgr.shared.showHanyuPinyinInCompositionBuffer = selShowHanyuPinyinInCompositionBuffer
}
isOn: $showHanyuPinyinInCompositionBuffer
)
Toggle(
LocalizedStringKey("Allow backspace-editing miscomposed readings"),
isOn: $selKeepReadingUponCompositionError.onChange {
PrefMgr.shared.keepReadingUponCompositionError = selKeepReadingUponCompositionError
}
isOn: $keepReadingUponCompositionError
)
Toggle(
LocalizedStringKey("Also use “\\” or “¥” key for Hanin Keyboard Symbol Input"),
isOn: $selClassicHaninKeyboardSymbolModeShortcutEnabled.onChange {
PrefMgr.shared.classicHaninKeyboardSymbolModeShortcutEnabled
= selClassicHaninKeyboardSymbolModeShortcutEnabled
}
isOn: $classicHaninKeyboardSymbolModeShortcutEnabled
)
Toggle(
LocalizedStringKey("Emulating select-candidate-per-character mode"),
isOn: $selEnableSCPCTypingMode.onChange {
PrefMgr.shared.useSCPCTypingMode = selEnableSCPCTypingMode
isOn: $useSCPCTypingMode.onChange {
guard useSCPCTypingMode else { return }
LMMgr.loadUserSCPCSequencesData()
}
)
Text(LocalizedStringKey("An accommodation for elder computer users."))
@ -123,7 +133,7 @@ struct VwrPrefPaneGeneral: View {
if Date.isTodayTheDate(from: 0401) {
Toggle(
LocalizedStringKey("Stop farting (when typed phonetic combination is invalid, etc.)"),
isOn: $selEnableFartSuppressor.onChange {
isOn: $shouldNotFartInLieuOfBeep.onChange {
let content = String(
format: NSLocalizedString(
"You are about to uncheck this fart suppressor. You are responsible for all consequences lead by letting people nearby hear the fart sound come from your computer. We strongly advise against unchecking this in any public circumstance that prohibits NSFW netas.",
@ -138,22 +148,20 @@ struct VwrPrefPaneGeneral: View {
}
}
alert.addButton(withTitle: NSLocalizedString("Leave it checked", comment: ""))
if let window = CtlPrefUIShared.sharedWindow, !selEnableFartSuppressor {
PrefMgr.shared.shouldNotFartInLieuOfBeep = true
if let window = CtlPrefUIShared.sharedWindow, !shouldNotFartInLieuOfBeep {
shouldNotFartInLieuOfBeep = true
alert.beginSheetModal(for: window) { result in
switch result {
case .alertFirstButtonReturn:
PrefMgr.shared.shouldNotFartInLieuOfBeep = false
shouldNotFartInLieuOfBeep = false
case .alertSecondButtonReturn:
PrefMgr.shared.shouldNotFartInLieuOfBeep = true
shouldNotFartInLieuOfBeep = true
default: break
}
selEnableFartSuppressor = PrefMgr.shared.shouldNotFartInLieuOfBeep
IMEApp.buzz()
}
return
}
PrefMgr.shared.shouldNotFartInLieuOfBeep = selEnableFartSuppressor
IMEApp.buzz()
}
)
@ -162,16 +170,12 @@ struct VwrPrefPaneGeneral: View {
SSPreferences.Section(label: { Text(LocalizedStringKey("Misc Settings:")).controlSize(.small) }) {
Toggle(
LocalizedStringKey("Check for updates automatically"),
isOn: $selEnableAutoUpdateCheck.onChange {
PrefMgr.shared.checkUpdateAutomatically = selEnableAutoUpdateCheck
}
isOn: $checkUpdateAutomatically
)
.controlSize(.small)
Toggle(
LocalizedStringKey("Debug Mode"),
isOn: $selEnableDebugMode.onChange {
PrefMgr.shared.isDebugModeEnabled = selEnableDebugMode
}
isOn: $isDebugModeEnabled
)
.controlSize(.small)
}

View File

@ -11,15 +11,28 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneKeyboard: View {
@State private var selKeyboardParser = UserDefaults.standard.integer(forKey: UserDef.kKeyboardParser.rawValue)
@State private var selBasicKeyboardLayout: String =
UserDefaults.standard.string(forKey: UserDef.kBasicKeyboardLayout.rawValue) ?? PrefMgr.shared.basicKeyboardLayout
@State private var selAlphanumericalKeyboardLayout: String =
UserDefaults.standard.string(forKey: UserDef.kAlphanumericalKeyboardLayout.rawValue)
?? PrefMgr.shared.alphanumericalKeyboardLayout
// MARK: - AppStorage Variables
@Backport.AppStorage(wrappedValue: 0, UserDef.kKeyboardParser.rawValue)
private var keyboardParser: Int
@Backport.AppStorage(
wrappedValue: PrefMgr.kDefaultBasicKeyboardLayout,
UserDef.kBasicKeyboardLayout.rawValue
)
private var basicKeyboardLayout: String
@Backport.AppStorage(
wrappedValue: PrefMgr.kDefaultAlphanumericalKeyboardLayout,
UserDef.kAlphanumericalKeyboardLayout.rawValue
)
private var alphanumericalKeyboardLayout: String
// MARK: - Main View
var body: some View {
ScrollView {
@ -27,26 +40,20 @@ struct VwrPrefPaneKeyboard: View {
SSPreferences.Section(title: "Quick Setup:".localized) {
HStack(alignment: .top) {
Button {
PrefMgr.shared.keyboardParser = 0
selKeyboardParser = PrefMgr.shared.keyboardParser
PrefMgr.shared.basicKeyboardLayout = "com.apple.keylayout.ZhuyinBopomofo"
selBasicKeyboardLayout = PrefMgr.shared.basicKeyboardLayout
keyboardParser = 0
basicKeyboardLayout = "com.apple.keylayout.ZhuyinBopomofo"
} label: {
Text("↻ㄅ" + " " + NSLocalizedString("Dachen Trad.", comment: ""))
}
Button {
PrefMgr.shared.keyboardParser = 1
selKeyboardParser = PrefMgr.shared.keyboardParser
PrefMgr.shared.basicKeyboardLayout = "com.apple.keylayout.ZhuyinEten"
selBasicKeyboardLayout = PrefMgr.shared.basicKeyboardLayout
keyboardParser = 1
basicKeyboardLayout = "com.apple.keylayout.ZhuyinEten"
} label: {
Text("↻ㄅ" + " " + NSLocalizedString("Eten Trad.", comment: ""))
}
Button {
PrefMgr.shared.keyboardParser = 10
selKeyboardParser = PrefMgr.shared.keyboardParser
PrefMgr.shared.basicKeyboardLayout = "com.apple.keylayout.ABC"
selBasicKeyboardLayout = PrefMgr.shared.basicKeyboardLayout
keyboardParser = 10
basicKeyboardLayout = "com.apple.keylayout.ABC"
} label: {
Text("↻A")
}
@ -56,10 +63,7 @@ struct VwrPrefPaneKeyboard: View {
HStack {
Picker(
"",
selection: $selKeyboardParser.onChange {
let value = selKeyboardParser
PrefMgr.shared.keyboardParser = value
}
selection: $keyboardParser
) {
ForEach(KeyboardParser.allCases, id: \.self) { item in
if [7, 10].contains(item.rawValue) { Divider() }
@ -77,10 +81,7 @@ struct VwrPrefPaneKeyboard: View {
HStack {
Picker(
"",
selection: $selBasicKeyboardLayout.onChange {
let value = selBasicKeyboardLayout
PrefMgr.shared.basicKeyboardLayout = value
}
selection: $basicKeyboardLayout
) {
ForEach(0 ... (IMKHelper.allowedBasicLayoutsAsTISInputSources.count - 1), id: \.self) { id in
let theEntry = IMKHelper.allowedBasicLayoutsAsTISInputSources[id]
@ -106,9 +107,7 @@ struct VwrPrefPaneKeyboard: View {
HStack {
Picker(
"",
selection: $selAlphanumericalKeyboardLayout.onChange {
PrefMgr.shared.alphanumericalKeyboardLayout = selAlphanumericalKeyboardLayout
}
selection: $alphanumericalKeyboardLayout
) {
ForEach(0 ... (IMKHelper.allowedAlphanumericalTISInputSources.count - 1), id: \.self) { id in
if let theEntry = IMKHelper.allowedAlphanumericalTISInputSources[id] {
@ -138,79 +137,77 @@ struct VwrPrefPaneKeyboard: View {
@available(macOS 10.15, *)
private struct VwrPrefPaneKeyboard_KeyboardShortcuts: View {
@State private var selUsingHotKeySCPC = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeySCPC.rawValue)
@State private var selUsingHotKeyAssociates = UserDefaults.standard.bool(
forKey: UserDef.kUsingHotKeyAssociates.rawValue)
@State private var selUsingHotKeyCNS = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeyCNS.rawValue)
@State private var selUsingHotKeyKangXi = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeyKangXi.rawValue)
@State private var selUsingHotKeyJIS = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeyJIS.rawValue)
@State private var selUsingHotKeyHalfWidthASCII = UserDefaults.standard.bool(
forKey: UserDef.kUsingHotKeyHalfWidthASCII.rawValue)
@State private var selUsingHotKeyCurrencyNumerals = UserDefaults.standard.bool(
forKey: UserDef.kUsingHotKeyCurrencyNumerals.rawValue)
@State private var selUsingHotKeyCassette = UserDefaults.standard.bool(
forKey: UserDef.kUsingHotKeyCassette.rawValue)
@State private var selUsingHotKeyRevLookup = UserDefaults.standard.bool(
forKey: UserDef.kUsingHotKeyRevLookup.rawValue)
// MARK: - AppStorage Variables
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeySCPC.rawValue)
private var usingHotKeySCPC: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyAssociates.rawValue)
private var usingHotKeyAssociates: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyCNS.rawValue)
private var usingHotKeyCNS: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyKangXi.rawValue)
private var usingHotKeyKangXi: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyJIS.rawValue)
private var usingHotKeyJIS: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyHalfWidthASCII.rawValue)
private var usingHotKeyHalfWidthASCII: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyCurrencyNumerals.rawValue)
private var usingHotKeyCurrencyNumerals: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyCassette.rawValue)
private var usingHotKeyCassette: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kUsingHotKeyRevLookup.rawValue)
private var usingHotKeyRevLookup: Bool
// MARK: - Main View
var body: some View {
HStack(alignment: .top, spacing: NSFont.systemFontSize) {
VStack(alignment: .leading) {
Toggle(
LocalizedStringKey("Per-Char Select Mode"),
isOn: $selUsingHotKeySCPC.onChange {
PrefMgr.shared.usingHotKeySCPC = selUsingHotKeySCPC
}
isOn: $usingHotKeySCPC
)
Toggle(
LocalizedStringKey("Per-Char Associated Phrases"),
isOn: $selUsingHotKeyAssociates.onChange {
PrefMgr.shared.usingHotKeyAssociates = selUsingHotKeyAssociates
}
isOn: $usingHotKeyAssociates
)
Toggle(
LocalizedStringKey("CNS11643 Mode"),
isOn: $selUsingHotKeyCNS.onChange {
PrefMgr.shared.usingHotKeyCNS = selUsingHotKeyCNS
}
isOn: $usingHotKeyCNS
)
Toggle(
LocalizedStringKey("Force KangXi Writing"),
isOn: $selUsingHotKeyKangXi.onChange {
PrefMgr.shared.usingHotKeyKangXi = selUsingHotKeyKangXi
}
isOn: $usingHotKeyKangXi
)
Toggle(
LocalizedStringKey("Reverse Lookup (Phonabets)"),
isOn: $selUsingHotKeyRevLookup.onChange {
PrefMgr.shared.usingHotKeyRevLookup = selUsingHotKeyRevLookup
}
isOn: $usingHotKeyRevLookup
)
}
VStack(alignment: .leading) {
Toggle(
LocalizedStringKey("JIS Shinjitai Output"),
isOn: $selUsingHotKeyJIS.onChange {
PrefMgr.shared.usingHotKeyJIS = selUsingHotKeyJIS
}
isOn: $usingHotKeyJIS
)
Toggle(
LocalizedStringKey("Half-Width Punctuation Mode"),
isOn: $selUsingHotKeyHalfWidthASCII.onChange {
PrefMgr.shared.usingHotKeyHalfWidthASCII = selUsingHotKeyHalfWidthASCII
}
isOn: $usingHotKeyHalfWidthASCII
)
Toggle(
LocalizedStringKey("Currency Numeral Output"),
isOn: $selUsingHotKeyCurrencyNumerals.onChange {
PrefMgr.shared.usingHotKeyCurrencyNumerals = selUsingHotKeyCurrencyNumerals
}
isOn: $usingHotKeyCurrencyNumerals
)
Toggle(
LocalizedStringKey("CIN Cassette Mode"),
isOn: $selUsingHotKeyCassette.onChange {
PrefMgr.shared.usingHotKeyCassette = selUsingHotKeyCassette
}
isOn: $usingHotKeyCassette
)
}
}

View File

@ -10,26 +10,28 @@ import Shared
import SSPreferences
import SwiftExtension
import SwiftUI
import SwiftUIBackports
@available(macOS 10.15, *)
struct VwrPrefPaneOutput: View {
@State private var selEnableKanjiConvToKangXi = UserDefaults.standard.bool(
forKey: UserDef.kChineseConversionEnabled.rawValue)
@State private var selEnableKanjiConvToJIS = UserDefaults.standard.bool(
forKey: UserDef.kShiftJISShinjitaiOutputEnabled.rawValue)
@State private var selInlineDumpPinyinInLieuOfZhuyin = UserDefaults.standard.bool(
forKey: UserDef.kInlineDumpPinyinInLieuOfZhuyin.rawValue)
@State private var selTrimUnfinishedReadingsOnCommit = UserDefaults.standard.bool(
forKey: UserDef.kTrimUnfinishedReadingsOnCommit.rawValue)
@State private var selHardenVerticalPunctuations: Bool = UserDefaults.standard.bool(
forKey: UserDef.kHardenVerticalPunctuations.rawValue)
// MARK: - AppStorage Variables
var macOSMontereyOrLaterDetected: Bool {
if #available(macOS 12, *) {
return true
}
return false
}
@Backport.AppStorage(wrappedValue: false, UserDef.kChineseConversionEnabled.rawValue)
private var chineseConversionEnabled: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kShiftJISShinjitaiOutputEnabled.rawValue)
private var shiftJISShinjitaiOutputEnabled: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kInlineDumpPinyinInLieuOfZhuyin.rawValue)
private var inlineDumpPinyinInLieuOfZhuyin: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kTrimUnfinishedReadingsOnCommit.rawValue)
private var trimUnfinishedReadingsOnCommit: Bool
@Backport.AppStorage(wrappedValue: false, UserDef.kHardenVerticalPunctuations.rawValue)
private var hardenVerticalPunctuations: Bool
// MARK: - Main View
var body: some View {
ScrollView {
@ -37,37 +39,33 @@ struct VwrPrefPaneOutput: View {
SSPreferences.Section(title: "Output Settings:".localized, bottomDivider: true) {
Toggle(
LocalizedStringKey("Auto-convert traditional Chinese glyphs to KangXi characters"),
isOn: $selEnableKanjiConvToKangXi.onChange {
PrefMgr.shared.chineseConversionEnabled = selEnableKanjiConvToKangXi
selEnableKanjiConvToJIS = PrefMgr.shared.shiftJISShinjitaiOutputEnabled
isOn: $chineseConversionEnabled.onChange {
if chineseConversionEnabled, shiftJISShinjitaiOutputEnabled {
shiftJISShinjitaiOutputEnabled = false
}
}
)
Toggle(
LocalizedStringKey("Auto-convert traditional Chinese glyphs to JIS Shinjitai characters"),
isOn: $selEnableKanjiConvToJIS.onChange {
PrefMgr.shared.shiftJISShinjitaiOutputEnabled = selEnableKanjiConvToJIS
selEnableKanjiConvToKangXi = PrefMgr.shared.chineseConversionEnabled
isOn: $shiftJISShinjitaiOutputEnabled.onChange {
if chineseConversionEnabled, shiftJISShinjitaiOutputEnabled {
chineseConversionEnabled = false
}
}
)
Toggle(
LocalizedStringKey("Commit Hanyu-Pinyin instead on Ctrl(+Option)+Command+Enter"),
isOn: $selInlineDumpPinyinInLieuOfZhuyin.onChange {
PrefMgr.shared.inlineDumpPinyinInLieuOfZhuyin = selInlineDumpPinyinInLieuOfZhuyin
}
isOn: $inlineDumpPinyinInLieuOfZhuyin
)
Toggle(
LocalizedStringKey("Trim unfinished readings / strokes on commit"),
isOn: $selTrimUnfinishedReadingsOnCommit.onChange {
PrefMgr.shared.trimUnfinishedReadingsOnCommit = selTrimUnfinishedReadingsOnCommit
}
isOn: $trimUnfinishedReadingsOnCommit
)
}
SSPreferences.Section(title: "Experimental:".localized) {
Toggle(
LocalizedStringKey("Harden vertical punctuations during vertical typing (not recommended)"),
isOn: $selHardenVerticalPunctuations.onChange {
PrefMgr.shared.hardenVerticalPunctuations = selHardenVerticalPunctuations
}
isOn: $hardenVerticalPunctuations
)
Text(
LocalizedStringKey(

View File

@ -14,13 +14,6 @@ import SwiftUI
@available(macOS 10.15, *)
struct VwrPrefPanePhrases: View {
var isMontereyOrAbove: Bool = {
if #available(macOS 12.0, *) {
return true
}
return false
}()
var body: some View {
ScrollView {
VStack {

View File

@ -324,6 +324,7 @@
"The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu." = "The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu.";
"This conversion only affects the cassette module, converting typed contents to either Simplified Chinese or Traditional Chinese in accordance with this setting and your current input mode." = "This conversion only affects the cassette module, converting typed contents to either Simplified Chinese or Traditional Chinese in accordance with this setting and your current input mode.";
"This feature requires macOS 10.15 and above." = "This feature requires macOS 10.15 and above.";
"This feature requires macOS 12 and above." = "This feature requires macOS 12 and above.";
"This only works with Tadokoro candidate window." = "This only works with Tadokoro candidate window.";
"This will also affect the row / column capacity of the candidate window." = "This will also affect the row / column capacity of the candidate window.";
"This will batch-replace specified candidates." = "This will batch-replace specified candidates.";

View File

@ -324,6 +324,7 @@
"The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu." = "The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu.";
"This conversion only affects the cassette module, converting typed contents to either Simplified Chinese or Traditional Chinese in accordance with this setting and your current input mode." = "This conversion only affects the cassette module, converting typed contents to either Simplified Chinese or Traditional Chinese in accordance with this setting and your current input mode.";
"This feature requires macOS 10.15 and above." = "This feature requires macOS 10.15 and above.";
"This feature requires macOS 12 and above." = "This feature requires macOS 12 and above.";
"This only works with Tadokoro candidate window." = "This only works with Tadokoro candidate window.";
"This will also affect the row / column capacity of the candidate window." = "This will also affect the row / column capacity of the candidate window.";
"This will batch-replace specified candidates." = "This will batch-replace specified candidates.";

View File

@ -325,6 +325,7 @@
"The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu." = "臨時記憶モジュールは文字の通り「臨時的」の記憶をします。記録は六日間どんどん忘れてしまいます。入力アプリのメニューから全ての記録を消すことはできます。";
"This conversion only affects the cassette module, converting typed contents to either Simplified Chinese or Traditional Chinese in accordance with this setting and your current input mode." = "この転換はカセットモードだけに使える転換であり、転換結果はこの設定と入力モード次第である。";
"This feature requires macOS 10.15 and above." = "この機能の稼働には macOS 10.15 以降のシステムが必要である。";
"This feature requires macOS 12 and above." = "この機能の稼働には macOS 12 以降のシステムが必要である。";
"This only works with Tadokoro candidate window." = "これは田所候補陳列ウィンドウだけに効ける機能である。";
"This will also affect the row / column capacity of the candidate window." = "言選り用キーの数は、候補陳列の行・列の容量制限にも影響。";
"This will batch-replace specified candidates." = "指定された候補そのものを置き換える";

View File

@ -324,6 +324,7 @@
"The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu." = "半衰记忆模组仅持有临时记忆之功能。每一笔记录都会在六天之内逐渐变得彻底失效。您可以借由输入法选单清除全部的记忆记录。";
"This conversion only affects the cassette module, converting typed contents to either Simplified Chinese or Traditional Chinese in accordance with this setting and your current input mode." = "该转换仅对磁带模式有影响,会将键入的内容根据该选项与当前的简繁体模式来转换。";
"This feature requires macOS 10.15 and above." = "该功能要求系统版本至少 macOS 10.15。";
"This feature requires macOS 12 and above." = "该功能要求系统版本至少 macOS 12。";
"This only works with Tadokoro candidate window." = "该选项仅对田所选字窗起作用。";
"This will also affect the row / column capacity of the candidate window." = "该选项也会影响到选字窗每行/每列最多显示的候选字数量。";
"This will batch-replace specified candidates." = "这将会对指定的候选字词进行整词取代。";

View File

@ -324,6 +324,7 @@
"The user override model only possesses memories temporarily. Each memory record gradually becomes ineffective within approximately less than 6 days. You can erase all memory records through the input method menu." = "半衰記憶模組僅持有臨時記憶之功能。每一筆記錄都會在六天之內逐漸變得徹底失效。您可以藉由輸入法選單清除全部的記憶記錄。";
"This conversion only affects the cassette module, converting typed contents to either Simplified Chinese or Traditional Chinese in accordance with this setting and your current input mode." = "該轉換僅對磁帶模式有影響,會將鍵入的內容根據該選項與當前的簡繁體模式來轉換。";
"This feature requires macOS 10.15 and above." = "該功能要求系統版本至少 macOS 10.15。";
"This feature requires macOS 12 and above." = "該功能要求系統版本至少 macOS 12。";
"This only works with Tadokoro candidate window." = "該選項僅對田所選字窗起作用。";
"This will also affect the row / column capacity of the candidate window." = "該選項也會影響到選字窗每行/每列最多顯示的候選字數量。";
"This will batch-replace specified candidates." = "這將會對指定的候選字詞進行整詞取代。";