PrefUI // Add options for keyboard hotkeys.

This commit is contained in:
ShikiSuen 2022-05-27 22:27:20 +08:00
parent 116360a05d
commit 60b4c935a9
6 changed files with 60 additions and 2 deletions

View File

@ -130,6 +130,7 @@
"in front of the phrase (like macOS built-in Zhuyin IME)" = "in front of the phrase (like macOS built-in Zhuyin IME)";
"Japanese" = "Japanese";
"Keyboard" = "Keyboard";
"Keyboard Shortcuts:" = "Keyboard Shortcuts:";
"Misc Settings:" = "Misc Settings:";
"MiTAC" = "MiTAC";
"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only.";

View File

@ -130,6 +130,7 @@
"in front of the phrase (like macOS built-in Zhuyin IME)" = "in front of the phrase (like macOS built-in Zhuyin IME)";
"Japanese" = "Japanese";
"Keyboard" = "Keyboard";
"Keyboard Shortcuts:" = "Keyboard Shortcuts:";
"Misc Settings:" = "Misc Settings:";
"MiTAC" = "MiTAC";
"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only.";

View File

@ -130,6 +130,7 @@
"in front of the phrase (like macOS built-in Zhuyin IME)" = "単語の前で // macOS 内蔵注音入力のやり方";
"Japanese" = "和語";
"Keyboard" = "配列設定";
"Keyboard Shortcuts:" = "ショートカット:";
"Misc Settings:" = "他の設定:";
"MiTAC" = "神通配列";
"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外の英数キーボードは漢語弁音以外の配列に不適用。";

View File

@ -15,7 +15,7 @@
"Not Now" = "以后再说";
"Visit Website" = "前往网站";
"You're currently using vChewing %@ (%@), a new version %@ (%@) is now available. Do you want to visit vChewing's website to download the version?%@" = "目前使用的威注音官方版本是 %1$@ (%2$@),网路上有更新版本 %3$@ (%4$@) 可供下载。是否要前往威注音网站下载新版来安装?%5$@";
"Force KangXi Writing" = "康熙体字模式";
"Force KangXi Writing" = "康熙体字模式";
"NotificationSwitchON" = "✔ 已启用";
"NotificationSwitchOFF" = "✘ 已停用";
"Edit User Phrases…" = "编辑自订语汇…";
@ -131,6 +131,7 @@
"in front of the phrase (like macOS built-in Zhuyin IME)" = "将游标置于词语前方 // macOS 内建注音风格";
"Japanese" = "和语";
"Keyboard" = "键盘";
"Keyboard Shortcuts:" = "键盘快捷键:";
"Misc Settings:" = "杂项:";
"MiTAC" = "神通排列";
"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外的英数布局是为了汉语拼音排列使用者而准备的。";

View File

@ -15,7 +15,7 @@
"Not Now" = "以後再說";
"Visit Website" = "前往網站";
"You're currently using vChewing %@ (%@), a new version %@ (%@) is now available. Do you want to visit vChewing's website to download the version?%@" = "目前使用的威注音官方版本是 %1$@ (%2$@),網路上有更新版本 %3$@ (%4$@) 可供下載。是否要前往威注音網站下載新版來安裝?%5$@";
"Force KangXi Writing" = "康熙體字模式";
"Force KangXi Writing" = "康熙體字模式";
"NotificationSwitchON" = "✔ 已啟用";
"NotificationSwitchOFF" = "✘ 已停用";
"Edit User Phrases…" = "編輯自訂語彙…";
@ -130,6 +130,7 @@
"in front of the phrase (like macOS built-in Zhuyin IME)" = "將游標置於詞語前方 // macOS 內建注音風格";
"Japanese" = "和語";
"Keyboard" = "鍵盤";
"Keyboard Shortcuts:" = "鍵盤快速鍵:";
"Misc Settings:" = "雜項:";
"MiTAC" = "神通排列";
"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外的英數佈局是為了漢語拼音排列使用者而準備的。";

View File

@ -29,6 +29,15 @@ struct suiPrefPaneKeyboard: View {
@State private var selMandarinParser = UserDefaults.standard.integer(forKey: UserDef.kMandarinParser)
@State private var selBasicKeyboardLayout: String =
UserDefaults.standard.string(forKey: UserDef.kBasicKeyboardLayout) ?? mgrPrefs.basicKeyboardLayout
@State private var selUsingHotKeySCPC = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeySCPC)
@State private var selUsingHotKeyAssociates = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeyAssociates)
@State private var selUsingHotKeyCNS = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeyCNS)
@State private var selUsingHotKeyKangXi = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeyKangXi)
@State private var selUsingHotKeyJIS = UserDefaults.standard.bool(forKey: UserDef.kUsingHotKeyJIS)
@State private var selUsingHotKeyHalfWidthASCII = UserDefaults.standard.bool(
forKey: UserDef.kUsingHotKeyHalfWidthASCII)
private let contentWidth: Double = {
switch mgrPrefs.appleLanguages[0] {
case "ja":
@ -122,6 +131,50 @@ struct suiPrefPaneKeyboard: View {
Text(LocalizedStringKey("Choose the macOS-level basic keyboard layout."))
.preferenceDescription()
}
Preferences.Section(bottomDivider: true, label: { Text(LocalizedStringKey("Keyboard Shortcuts:")) }) {
Toggle(
LocalizedStringKey("Per-Char Select Mode"),
isOn: $selUsingHotKeySCPC
).onChange(of: selUsingHotKeySCPC) { value in
mgrPrefs.usingHotKeySCPC = value
selUsingHotKeySCPC = value
}
Toggle(
LocalizedStringKey("Per-Char Associated Phrases"),
isOn: $selUsingHotKeyAssociates
).onChange(of: selUsingHotKeyAssociates) { value in
mgrPrefs.usingHotKeyAssociates = value
selUsingHotKeyAssociates = value
}
Toggle(
LocalizedStringKey("CNS11643 Mode"),
isOn: $selUsingHotKeyCNS
).onChange(of: selUsingHotKeyCNS) { value in
mgrPrefs.usingHotKeyCNS = value
selUsingHotKeyCNS = value
}
Toggle(
LocalizedStringKey("Force KangXi Writing"),
isOn: $selUsingHotKeyKangXi
).onChange(of: selUsingHotKeyKangXi) { value in
mgrPrefs.usingHotKeyKangXi = value
selUsingHotKeyKangXi = value
}
Toggle(
LocalizedStringKey("JIS Shinjitai Output"),
isOn: $selUsingHotKeyJIS
).onChange(of: selUsingHotKeyJIS) { value in
mgrPrefs.usingHotKeyJIS = value
selUsingHotKeyJIS = value
}
Toggle(
LocalizedStringKey("Half-Width Punctuation Mode"),
isOn: $selUsingHotKeyHalfWidthASCII
).onChange(of: selUsingHotKeyHalfWidthASCII) { value in
mgrPrefs.usingHotKeyHalfWidthASCII = value
selUsingHotKeyHalfWidthASCII = value
}
}
}
Divider()
Preferences.Container(contentWidth: contentWidth) {