From 331942c0b45a05661d6cde76c720f317b74c4e82 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 10 Jul 2022 09:17:08 +0800 Subject: [PATCH] InputState // Show readings when in-place marking phrases. --- .../ControllerModules/InputState.swift | 31 ++++++++++++++++--- .../Resources/Base.lproj/Localizable.strings | 2 +- Source/Resources/en.lproj/Localizable.strings | 2 +- Source/Resources/ja.lproj/Localizable.strings | 2 +- .../zh-Hans.lproj/Localizable.strings | 2 +- .../zh-Hant.lproj/Localizable.strings | 2 +- Source/UI/PrefUI/suiPrefPaneGeneral.swift | 2 +- .../WindowNIBs/Base.lproj/frmPrefWindow.xib | 2 +- .../WindowNIBs/en.lproj/frmPrefWindow.strings | 2 +- .../WindowNIBs/ja.lproj/frmPrefWindow.strings | 2 +- .../zh-Hans.lproj/frmPrefWindow.strings | 2 +- .../zh-Hant.lproj/frmPrefWindow.strings | 2 +- 12 files changed, 37 insertions(+), 16 deletions(-) diff --git a/Source/Modules/ControllerModules/InputState.swift b/Source/Modules/ControllerModules/InputState.swift index 4587c486..bfe0cab9 100644 --- a/Source/Modules/ControllerModules/InputState.swift +++ b/Source/Modules/ControllerModules/InputState.swift @@ -228,6 +228,27 @@ enum InputState { return lowerBoundLiteral..注音轉拼音->轉教科書式標調 + 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 ) } diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index 261aa368..c4faf713 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -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:"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index 261aa368..c4faf713 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -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:"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 057cc480..79a8751b 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -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:"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index 81e9a423..8cb3ee1f 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -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 与空格键:"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index b4c27069..2f13703c 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -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 與空格鍵:"; diff --git a/Source/UI/PrefUI/suiPrefPaneGeneral.swift b/Source/UI/PrefUI/suiPrefPaneGeneral.swift index 1551f0e9..093b9ba9 100644 --- a/Source/UI/PrefUI/suiPrefPaneGeneral.swift +++ b/Source/UI/PrefUI/suiPrefPaneGeneral.swift @@ -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 diff --git a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib index 7dc12991..ae6afabc 100644 --- a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib +++ b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib @@ -269,7 +269,7 @@