KeyHandler // Add DachenCP26 and Hanyu-Pinyin support, etc.
- Also use getComposition() in lieu of realComposition().
This commit is contained in:
parent
6e6cce7f4f
commit
48d434f087
|
@ -328,6 +328,8 @@ class KeyHandler: NSObject {
|
||||||
switch mgrPrefs.mandarinParser {
|
switch mgrPrefs.mandarinParser {
|
||||||
case MandarinParser.ofStandard.rawValue:
|
case MandarinParser.ofStandard.rawValue:
|
||||||
_composer.ensureParser(arrange: .ofDachen)
|
_composer.ensureParser(arrange: .ofDachen)
|
||||||
|
case MandarinParser.ofDachen26.rawValue:
|
||||||
|
_composer.ensureParser(arrange: .ofDachen26)
|
||||||
case MandarinParser.ofEten.rawValue:
|
case MandarinParser.ofEten.rawValue:
|
||||||
_composer.ensureParser(arrange: .ofEten)
|
_composer.ensureParser(arrange: .ofEten)
|
||||||
case MandarinParser.ofHsu.rawValue:
|
case MandarinParser.ofHsu.rawValue:
|
||||||
|
@ -340,6 +342,8 @@ class KeyHandler: NSObject {
|
||||||
_composer.ensureParser(arrange: .ofMiTAC)
|
_composer.ensureParser(arrange: .ofMiTAC)
|
||||||
case MandarinParser.ofFakeSeigyou.rawValue:
|
case MandarinParser.ofFakeSeigyou.rawValue:
|
||||||
_composer.ensureParser(arrange: .ofFakeSeigyou)
|
_composer.ensureParser(arrange: .ofFakeSeigyou)
|
||||||
|
case MandarinParser.ofHanyuPinyin.rawValue:
|
||||||
|
_composer.ensureParser(arrange: .ofHanyuPinyin)
|
||||||
default:
|
default:
|
||||||
_composer.ensureParser(arrange: .ofDachen)
|
_composer.ensureParser(arrange: .ofDachen)
|
||||||
mgrPrefs.mandarinParser = MandarinParser.ofStandard.rawValue
|
mgrPrefs.mandarinParser = MandarinParser.ofStandard.rawValue
|
||||||
|
|
|
@ -166,7 +166,7 @@ extension KeyHandler {
|
||||||
// However, Swift does not support "|=".
|
// However, Swift does not support "|=".
|
||||||
composeReading = composeReading || (!_composer.isEmpty && (input.isSpace || input.isEnter))
|
composeReading = composeReading || (!_composer.isEmpty && (input.isSpace || input.isEnter))
|
||||||
if composeReading {
|
if composeReading {
|
||||||
let reading = _composer.realComposition
|
let reading = _composer.getComposition()
|
||||||
|
|
||||||
// See whether we have a unigram for this...
|
// See whether we have a unigram for this...
|
||||||
if !ifLangModelHasUnigrams(forKey: reading) {
|
if !ifLangModelHasUnigrams(forKey: reading) {
|
||||||
|
|
|
@ -89,7 +89,7 @@ extension KeyHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
let head = rawHead
|
let head = rawHead
|
||||||
let reading = _composer.getComposition(isHanyuPinyin: mgrPrefs.showHanyuPinyinInCompositionBuffer)
|
let reading = _composer.getInlineCompositionForIMK(isHanyuPinyin: mgrPrefs.showHanyuPinyinInCompositionBuffer)
|
||||||
let tail = rawEnd
|
let tail = rawEnd
|
||||||
let composedText = head + reading + tail
|
let composedText = head + reading + tail
|
||||||
let cursorIndex = composedStringCursorIndex + reading.count
|
let cursorIndex = composedStringCursorIndex + reading.count
|
||||||
|
|
|
@ -174,6 +174,7 @@ struct ComposingBufferSize {
|
||||||
case ofIBM = 4
|
case ofIBM = 4
|
||||||
case ofMiTAC = 5
|
case ofMiTAC = 5
|
||||||
case ofFakeSeigyou = 6
|
case ofFakeSeigyou = 6
|
||||||
|
case ofDachen26 = 7
|
||||||
case ofHanyuPinyin = 10
|
case ofHanyuPinyin = 10
|
||||||
|
|
||||||
var name: String {
|
var name: String {
|
||||||
|
@ -192,6 +193,8 @@ struct ComposingBufferSize {
|
||||||
return "MiTAC"
|
return "MiTAC"
|
||||||
case .ofFakeSeigyou:
|
case .ofFakeSeigyou:
|
||||||
return "FakeSeigyou"
|
return "FakeSeigyou"
|
||||||
|
case .ofDachen26:
|
||||||
|
return "Dachen26"
|
||||||
case .ofHanyuPinyin:
|
case .ofHanyuPinyin:
|
||||||
return "HanyuPinyin"
|
return "HanyuPinyin"
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
"Choose your preferred layout of the candidate window." = "Choose your preferred layout of the candidate window.";
|
"Choose your preferred layout of the candidate window." = "Choose your preferred layout of the candidate window.";
|
||||||
"Cursor Selection:" = "Cursor Selection:";
|
"Cursor Selection:" = "Cursor Selection:";
|
||||||
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "Dachen (Microsoft Standard / Wang / 01, etc.)";
|
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "Dachen (Microsoft Standard / Wang / 01, etc.)";
|
||||||
|
"Dachen 26 (libChewing)" = "Dachen 26 (libChewing)";
|
||||||
"Debug Mode" = "Debug Mode";
|
"Debug Mode" = "Debug Mode";
|
||||||
"Dictionary" = "Dictionary";
|
"Dictionary" = "Dictionary";
|
||||||
"Emulating select-candidate-per-character mode" = "Emulating select-candidate-per-character mode";
|
"Emulating select-candidate-per-character mode" = "Emulating select-candidate-per-character mode";
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
"Choose your preferred layout of the candidate window." = "Choose your preferred layout of the candidate window.";
|
"Choose your preferred layout of the candidate window." = "Choose your preferred layout of the candidate window.";
|
||||||
"Cursor Selection:" = "Cursor Selection:";
|
"Cursor Selection:" = "Cursor Selection:";
|
||||||
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "Dachen (Microsoft Standard / Wang / 01, etc.)";
|
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "Dachen (Microsoft Standard / Wang / 01, etc.)";
|
||||||
|
"Dachen 26 (libChewing)" = "Dachen 26 (libChewing)";
|
||||||
"Debug Mode" = "Debug Mode";
|
"Debug Mode" = "Debug Mode";
|
||||||
"Dictionary" = "Dictionary";
|
"Dictionary" = "Dictionary";
|
||||||
"Emulating select-candidate-per-character mode" = "Emulating select-candidate-per-character mode";
|
"Emulating select-candidate-per-character mode" = "Emulating select-candidate-per-character mode";
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
"Choose your preferred layout of the candidate window." = "入力候補陳列の仕様をご指定ください。";
|
"Choose your preferred layout of the candidate window." = "入力候補陳列の仕様をご指定ください。";
|
||||||
"Cursor Selection:" = "カーソル候補呼出:";
|
"Cursor Selection:" = "カーソル候補呼出:";
|
||||||
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "大千配列 (Microsoft 標準・王安・零壹など)";
|
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "大千配列 (Microsoft 標準・王安・零壹など)";
|
||||||
|
"Dachen 26 (libChewing)" = "酷音大千二十六キー";
|
||||||
"Debug Mode" = "欠陥辿着モード";
|
"Debug Mode" = "欠陥辿着モード";
|
||||||
"Dictionary" = "辞書設定";
|
"Dictionary" = "辞書設定";
|
||||||
"Emulating select-candidate-per-character mode" = "漢字1つづつ全候補選択入力モード";
|
"Emulating select-candidate-per-character mode" = "漢字1つづつ全候補選択入力モード";
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
"Choose your preferred layout of the candidate window." = "选择您所偏好的候选字窗布局。";
|
"Choose your preferred layout of the candidate window." = "选择您所偏好的候选字窗布局。";
|
||||||
"Cursor Selection:" = "选字游标:";
|
"Cursor Selection:" = "选字游标:";
|
||||||
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "大千排列 (微软标准/王安/零壹/仲鼎/国乔)";
|
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "大千排列 (微软标准/王安/零壹/仲鼎/国乔)";
|
||||||
|
"Dachen 26 (libChewing)" = "酷音大千二十六键";
|
||||||
"Debug Mode" = "侦错模式";
|
"Debug Mode" = "侦错模式";
|
||||||
"Dictionary" = "辞典";
|
"Dictionary" = "辞典";
|
||||||
"Emulating select-candidate-per-character mode" = "模拟 90 年代前期注音逐字选字输入风格";
|
"Emulating select-candidate-per-character mode" = "模拟 90 年代前期注音逐字选字输入风格";
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
"Choose your preferred layout of the candidate window." = "選擇您所偏好的候選字窗佈局。";
|
"Choose your preferred layout of the candidate window." = "選擇您所偏好的候選字窗佈局。";
|
||||||
"Cursor Selection:" = "選字游標:";
|
"Cursor Selection:" = "選字游標:";
|
||||||
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "大千排列 (微軟標準/王安/零壹/仲鼎/國喬)";
|
"Dachen (Microsoft Standard / Wang / 01, etc.)" = "大千排列 (微軟標準/王安/零壹/仲鼎/國喬)";
|
||||||
|
"Dachen 26 (libChewing)" = "酷音大千二十六鍵";
|
||||||
"Debug Mode" = "偵錯模式";
|
"Debug Mode" = "偵錯模式";
|
||||||
"Dictionary" = "辭典";
|
"Dictionary" = "辭典";
|
||||||
"Emulating select-candidate-per-character mode" = "模擬 90 年代前期注音逐字選字輸入風格";
|
"Emulating select-candidate-per-character mode" = "模擬 90 年代前期注音逐字選字輸入風格";
|
||||||
|
|
|
@ -47,6 +47,7 @@ struct suiPrefPaneKeyboard: View {
|
||||||
Preferences.Section(label: { Text(LocalizedStringKey("Phonetic Parser:")) }) {
|
Preferences.Section(label: { Text(LocalizedStringKey("Phonetic Parser:")) }) {
|
||||||
Picker("", selection: $selMandarinParser) {
|
Picker("", selection: $selMandarinParser) {
|
||||||
Text(LocalizedStringKey("Dachen (Microsoft Standard / Wang / 01, etc.)")).tag(0)
|
Text(LocalizedStringKey("Dachen (Microsoft Standard / Wang / 01, etc.)")).tag(0)
|
||||||
|
Text(LocalizedStringKey("Dachen 26 (libChewing)")).tag(7)
|
||||||
Text(LocalizedStringKey("Eten Traditional")).tag(1)
|
Text(LocalizedStringKey("Eten Traditional")).tag(1)
|
||||||
Text(LocalizedStringKey("Eten 26")).tag(3)
|
Text(LocalizedStringKey("Eten 26")).tag(3)
|
||||||
Text(LocalizedStringKey("IBM")).tag(4)
|
Text(LocalizedStringKey("IBM")).tag(4)
|
||||||
|
|
|
@ -782,6 +782,7 @@
|
||||||
<menu key="menu" title="OtherViews" id="5">
|
<menu key="menu" title="OtherViews" id="5">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="Standard" state="on" id="6"/>
|
<menuItem title="Standard" state="on" id="6"/>
|
||||||
|
<menuItem title="Dachen 26" tag="7" id="xjP-r7-GaK"/>
|
||||||
<menuItem title="ETen" tag="1" id="7"/>
|
<menuItem title="ETen" tag="1" id="7"/>
|
||||||
<menuItem title="ETen26" tag="3" id="9"/>
|
<menuItem title="ETen26" tag="3" id="9"/>
|
||||||
<menuItem title="IBM" tag="4" id="137"/>
|
<menuItem title="IBM" tag="4" id="137"/>
|
||||||
|
|
|
@ -232,3 +232,6 @@
|
||||||
|
|
||||||
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
||||||
"iWy-Nw-QKB.title" = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter";
|
"iWy-Nw-QKB.title" = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter";
|
||||||
|
|
||||||
|
/* Class = "NSMenuItem"; title = "Dachen 26 (libChewing)"; ObjectID = "xjP-r7-GaK"; */
|
||||||
|
"xjP-r7-GaK.title" = "Dachen 26 (libChewing)";
|
||||||
|
|
|
@ -232,3 +232,6 @@
|
||||||
|
|
||||||
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
||||||
"iWy-Nw-QKB.title" = "Ctrl(+Alt)+CMD+Enter で出すのを漢語弁音と変換";
|
"iWy-Nw-QKB.title" = "Ctrl(+Alt)+CMD+Enter で出すのを漢語弁音と変換";
|
||||||
|
|
||||||
|
/* Class = "NSMenuItem"; title = "Dachen 26 (libChewing)"; ObjectID = "xjP-r7-GaK"; */
|
||||||
|
"xjP-r7-GaK.title" = "酷音大千二十六キー";
|
||||||
|
|
|
@ -232,3 +232,6 @@
|
||||||
|
|
||||||
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
||||||
"iWy-Nw-QKB.title" = "Ctrl(+Alt)+CMD+Enter 输出汉语拼音而非注音";
|
"iWy-Nw-QKB.title" = "Ctrl(+Alt)+CMD+Enter 输出汉语拼音而非注音";
|
||||||
|
|
||||||
|
/* Class = "NSMenuItem"; title = "Dachen 26 (libChewing)"; ObjectID = "xjP-r7-GaK"; */
|
||||||
|
"xjP-r7-GaK.title" = "酷音大千二十六键";
|
||||||
|
|
|
@ -232,3 +232,6 @@
|
||||||
|
|
||||||
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
/* Class = "NSButtonCell"; title = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; ObjectID = "iWy-Nw-QKB"; */
|
||||||
"iWy-Nw-QKB.title" = "Ctrl(+Alt)+CMD+Enter 輸出漢語拼音而非注音";
|
"iWy-Nw-QKB.title" = "Ctrl(+Alt)+CMD+Enter 輸出漢語拼音而非注音";
|
||||||
|
|
||||||
|
/* Class = "NSMenuItem"; title = "Dachen 26 (libChewing)"; ObjectID = "xjP-r7-GaK"; */
|
||||||
|
"xjP-r7-GaK.title" = "酷音大千二十六鍵";
|
||||||
|
|
Loading…
Reference in New Issue