InputState // Show readings when in-place marking phrases.

This commit is contained in:
ShikiSuen 2022-07-10 09:17:08 +08:00
parent 9a369a71cc
commit 331942c0b4
12 changed files with 37 additions and 16 deletions

View File

@ -228,6 +228,27 @@ enum InputState {
return lowerBoundLiteral..<upperBoundLiteral
}
var literalReadingThread: String {
var arrOutput = [String]()
for neta in readings[literalMarkedRange] {
var neta = neta
if neta.isEmpty { continue }
if neta.contains("_") {
arrOutput.append("??")
continue
}
if mgrPrefs.showHanyuPinyinInCompositionBuffer { // ->->調
neta = Tekkon.restoreToneOneInZhuyinKey(target: neta)
neta = Tekkon.cnvPhonaToHanyuPinyin(target: neta)
neta = Tekkon.cnvHanyuPinyinToTextbookStyle(target: neta)
} else {
neta = Tekkon.cnvZhuyinChainToTextbookReading(target: neta)
}
arrOutput.append(neta)
}
return arrOutput.joined(separator: " ")
}
private var deleteTargetExists = false
var tooltip: String {
if composingBuffer.count != readings.count {
@ -252,15 +273,14 @@ enum InputState {
return String(
format: NSLocalizedString(
"\"%@\" length must ≥ 2 for a user phrase.", comment: ""
), text
) + "\n// " + literalReadingThread, text
)
} else if literalMarkedRange.count > allowedMarkRange.upperBound {
ctlInputMethod.tooltipController.setColor(state: .denialOverflow)
return String(
format: NSLocalizedString(
"\"%@\" length should ≤ %d for a user phrase.", comment: ""
),
text, allowedMarkRange.upperBound
) + "\n// " + literalReadingThread, text, allowedMarkRange.upperBound
)
}
@ -275,12 +295,13 @@ enum InputState {
return String(
format: NSLocalizedString(
"\"%@\" already exists: ENTER to boost, \n SHIFT+CMD+ENTER to exclude.", comment: ""
), text
) + "\n// " + literalReadingThread, text
)
}
ctlInputMethod.tooltipController.resetColor()
return String(
format: NSLocalizedString("\"%@\" selected. ENTER to add user phrase.", comment: ""),
format: NSLocalizedString("\"%@\" selected. ENTER to add user phrase.", comment: "") + "\n// "
+ literalReadingThread,
text
)
}

View File

@ -146,7 +146,7 @@
"Push the cursor in front of the phrase after selection" = "Push the cursor in front of the phrase after selection";
"Secondary Pinyin with Numeral Intonation" = "Secondary Pinyin with Numeral Intonation";
"Selection Keys:" = "Selection Keys:";
"Show Hanyu-Pinyin in the inline composition buffer" = "Show Hanyu-Pinyin in the inline composition buffer";
"Show Hanyu-Pinyin in the inline composition buffer & tooltip" = "Show Hanyu-Pinyin in the inline composition buffer & tooltip";
"Show page buttons in candidate window" = "Show page buttons in candidate window";
"Simplified Chinese" = "Simplified Chinese";
"Space & ESC Key:" = "Space & ESC Key:";

View File

@ -146,7 +146,7 @@
"Push the cursor in front of the phrase after selection" = "Push the cursor in front of the phrase after selection";
"Secondary Pinyin with Numeral Intonation" = "Secondary Pinyin with Numeral Intonation";
"Selection Keys:" = "Selection Keys:";
"Show Hanyu-Pinyin in the inline composition buffer" = "Show Hanyu-Pinyin in the inline composition buffer";
"Show Hanyu-Pinyin in the inline composition buffer & tooltip" = "Show Hanyu-Pinyin in the inline composition buffer & tooltip";
"Show page buttons in candidate window" = "Show page buttons in candidate window";
"Simplified Chinese" = "Simplified Chinese";
"Space & ESC Key:" = "Space & ESC Key:";

View File

@ -146,7 +146,7 @@
"Push the cursor in front of the phrase after selection" = "候補選択の直後、すぐカーソルを単語の向こうに推し進める";
"Secondary Pinyin with Numeral Intonation" = "国音二式 (ローマ字+数字音調)";
"Selection Keys:" = "言選り用キー:";
"Show Hanyu-Pinyin in the inline composition buffer" = "弁音合併入力(入力緩衝列で代わりに漢語弁音の音読み";
"Show Hanyu-Pinyin in the inline composition buffer & tooltip" = "弁音合併入力(入力緩衝列とヒントで音読みを漢語弁音に";
"Show page buttons in candidate window" = "入力候補陳列の側にページボタンを表示";
"Simplified Chinese" = "簡体中国語";
"Space & ESC Key:" = "ESC と Space:";

View File

@ -147,7 +147,7 @@
"Push the cursor in front of the phrase after selection" = "在选字后将游标置于该字词的前方";
"Secondary Pinyin with Numeral Intonation" = "国音二式+数字标调";
"Selection Keys:" = "选字键:";
"Show Hanyu-Pinyin in the inline composition buffer" = "拼音并击模式(组字区内看到的是汉语拼音)";
"Show Hanyu-Pinyin in the inline composition buffer & tooltip" = "拼音并击(组字区与工具提示内显示汉语拼音)";
"Show page buttons in candidate window" = "在选字窗内显示翻页按钮";
"Simplified Chinese" = "简体中文";
"Space & ESC Key:" = "ESC 与空格键:";

View File

@ -146,7 +146,7 @@
"Push the cursor in front of the phrase after selection" = "在選字後將游標置於該字詞的前方";
"Secondary Pinyin with Numeral Intonation" = "國音二式+數字標調";
"Selection Keys:" = "選字鍵:";
"Show Hanyu-Pinyin in the inline composition buffer" = "拼音並擊模式(組字區內看到的是漢語拼音)";
"Show Hanyu-Pinyin in the inline composition buffer & tooltip" = "拼音並擊(組字區與工具提示內顯示漢語拼音)";
"Show page buttons in candidate window" = "在選字窗內顯示翻頁按鈕";
"Simplified Chinese" = "簡體中文";
"Space & ESC Key:" = "ESC 與空格鍵:";

View File

@ -158,7 +158,7 @@ struct suiPrefPaneGeneral: View {
}
}
Toggle(
LocalizedStringKey("Show Hanyu-Pinyin in the inline composition buffer"),
LocalizedStringKey("Show Hanyu-Pinyin in the inline composition buffer & tooltip"),
isOn: $selShowHanyuPinyinInCompositionBuffer
).onChange(of: selShowHanyuPinyinInCompositionBuffer) { value in
mgrPrefs.showHanyuPinyinInCompositionBuffer = value

View File

@ -269,7 +269,7 @@
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vwf-Kq-s8M" userLabel="chkShowHanyuPinyinInCompositionBuffer">
<rect key="frame" x="19" y="42.5" width="406" height="16"/>
<buttonCell key="cell" type="check" title="Show Hanyu-Pinyin in the inline composition buffer" bezelStyle="regularSquare" imagePosition="left" controlSize="small" inset="2" id="wFR-zX-M8H">
<buttonCell key="cell" type="check" title="Show Hanyu-Pinyin in the inline composition buffer &amp; tooltip" bezelStyle="regularSquare" imagePosition="left" controlSize="small" inset="2" id="wFR-zX-M8H">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="cellTitle"/>
</buttonCell>

View File

@ -74,7 +74,7 @@
"ueU-Rz-a1C.title" = "Choose the behavior of (Shift+)Tab key in the candidate window.";
"Uyz-xL-TVN.title" = "Output Settings";
"W24-T4-cg0.title" = "Enable CNS11643 Support (2022-06-15)";
"wFR-zX-M8H.title" = "Show Hanyu-Pinyin in the inline composition buffer";
"wFR-zX-M8H.title" = "Show Hanyu-Pinyin in the inline composition buffer & tooltip";
"wN3-k3-b2a.title" = "Choose your desired user data folder path. Will be omitted if invalid.";
"wQ9-px-b07.title" = "Apple Dynamic Bopomofo Basic Keyboard Layouts (Dachen & Eten Traditional) must match the Dachen parser in order to be functional.";
"Wvt-HE-LOv.title" = "Keyboard Layout";

View File

@ -74,7 +74,7 @@
"ueU-Rz-a1C.title" = "入力候補陳列での (Shift+)Tab キーの輪番切替対象をご指定ください。";
"Uyz-xL-TVN.title" = "出力設定";
"W24-T4-cg0.title" = "全字庫モード // 入力可能の漢字数倍増 (2022-06-15)";
"wFR-zX-M8H.title" = "弁音合併入力(入力緩衝列で代わりに漢語弁音の音読み";
"wFR-zX-M8H.title" = "弁音合併入力(入力緩衝列とヒントで音読みを漢語弁音に";
"wN3-k3-b2a.title" = "欲しがるユーザー辞書保存先をご指定ください。無効の保存先設定は効かぬ。";
"wQ9-px-b07.title" = "Apple 動態注音キーボード (大千と倚天伝統) を使うには、共通語分析器の注音配列を大千と設定すべきである。";
"Wvt-HE-LOv.title" = "キーボード";

View File

@ -74,7 +74,7 @@
"ueU-Rz-a1C.title" = "指定 (Shift+)Tab 热键在选字窗内的轮替操作对象。";
"Uyz-xL-TVN.title" = "输出设定";
"W24-T4-cg0.title" = "启用 CNS11643 全字库支援 (2022-06-15)";
"wFR-zX-M8H.title" = "拼音并击模式(组字区内看到的是汉语拼音)";
"wFR-zX-M8H.title" = "拼音并击(组字区与工具提示内显示汉语拼音)";
"wN3-k3-b2a.title" = "请在此指定您想指定的使用者语汇档案目录。无效值会被忽略。";
"wQ9-px-b07.title" = "Apple 动态注音键盘布局(大千与倚天)要求普通话/国音分析器的注音排列得配置为大千排列。";
"Wvt-HE-LOv.title" = "键盘布局";

View File

@ -74,7 +74,7 @@
"ueU-Rz-a1C.title" = "指定 (Shift+)Tab 熱鍵在選字窗內的輪替操作對象。";
"Uyz-xL-TVN.title" = "輸出設定";
"W24-T4-cg0.title" = "啟用 CNS11643 全字庫支援 (2022-06-15)";
"wFR-zX-M8H.title" = "拼音並擊模式(組字區內看到的是漢語拼音)";
"wFR-zX-M8H.title" = "拼音並擊(組字區與工具提示內顯示漢語拼音)";
"wN3-k3-b2a.title" = "請在此指定您想指定的使用者語彙檔案目錄。無效值會被忽略。";
"wQ9-px-b07.title" = "Apple 動態注音鍵盤佈局(大千與倚天)要求普通話/國音分析器的注音排列得配置為大千排列。";
"Wvt-HE-LOv.title" = "鍵盤佈局";