From 1edce13f6746a2212638e0f11761c46c7ce3ded6 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Fri, 12 May 2023 21:23:12 +0800 Subject: [PATCH] InputHandler // Show tooltip on overriding previous intonation. --- Source/Modules/InputHandler_HandleComposition.swift | 7 +++++++ Source/Resources/Base.lproj/Localizable.strings | 1 + Source/Resources/en.lproj/Localizable.strings | 1 + Source/Resources/ja.lproj/Localizable.strings | 1 + Source/Resources/zh-Hans.lproj/Localizable.strings | 1 + Source/Resources/zh-Hant.lproj/Localizable.strings | 1 + 6 files changed, 12 insertions(+) diff --git a/Source/Modules/InputHandler_HandleComposition.swift b/Source/Modules/InputHandler_HandleComposition.swift index dc99cd52..7dea9033 100644 --- a/Source/Modules/InputHandler_HandleComposition.swift +++ b/Source/Modules/InputHandler_HandleComposition.swift @@ -31,6 +31,7 @@ extension InputHandler { private func handlePhonabetComposition(input: InputSignalProtocol) -> Bool? { guard let delegate = delegate else { return nil } let existedIntonation = composer.intonation + var overrideHappened = false // 哪怕不啟用支援對「先輸入聲調、後輸入注音」的情況的支援,對 keyConsumedByReading 的處理得保留。 // 不然的話,「敲 Space 叫出選字窗」的功能會失效。 @@ -65,6 +66,7 @@ extension InputHandler { walk() // 這裡必須 Walk 一次、來更新目前被 walk 的內容。 composer = theComposer // 這裡不需要回呼 generateStateOfInputting(),因為當前輸入的聲調鍵一定是合規的、會在之後回呼 generateStateOfInputting()。 + overrideHappened = true } else { delegate.callError("4B0DD2D4:語彙庫內無「\(temporaryReadingKey)」的匹配記錄,放棄覆寫游標身後的內容。") return true @@ -140,6 +142,11 @@ extension InputHandler { // 再以回呼組字狀態的方式來執行 setInlineDisplayWithCursor()。 var inputting = generateStateOfInputting() inputting.textToCommit = textToCommit + if overrideHappened { + inputting.tooltip = "Previous intonation has been overridden.".localized + inputting.tooltipDuration = 2 + inputting.data.tooltipColorState = .normal + } delegate.switchState(inputting) /// 逐字選字模式的處理。 diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index c8e8f7d7..5c813e60 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "vChewing"; +"Previous intonation has been overridden." = "Previous intonation has been overridden."; "It will attempt to combine with the incoming phonabet input." = "It will attempt to combine with the incoming phonabet input."; "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer."; "CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index c8e8f7d7..5c813e60 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "vChewing"; +"Previous intonation has been overridden." = "Previous intonation has been overridden."; "It will attempt to combine with the incoming phonabet input." = "It will attempt to combine with the incoming phonabet input."; "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer."; "CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 6021c9fc..9781cc8d 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "威注音入力アプリ"; +"Previous intonation has been overridden." = "後ろ側の漢字の音調を書き直しました。"; "It will attempt to combine with the incoming phonabet input." = "この音調は次の注音入力と組み合わす。"; "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "音調記号。ENTER で送り出す。\nSPACE で入力緩衝列に挿入。"; "CHS / CHT Input Mode Switch" = "簡体・繁体中国語入力の切り替え"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index 46b7ebce..ff940df7 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "威注音输入法"; +"Previous intonation has been overridden." = "已覆写游标身后的汉字的音调。"; "It will attempt to combine with the incoming phonabet input." = "该声调亦会尝试与接下来输入的注音相组合。"; "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "声调符号。敲 Enter 以递交。\n敲空格键以插入组字区。"; "CHS / CHT Input Mode Switch" = "简体/繁体中文输入模式切换"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 040942a5..768b3f05 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -1,4 +1,5 @@ "vChewing" = "威注音輸入法"; +"Previous intonation has been overridden." = "已覆寫游標身後的漢字的音調。"; "It will attempt to combine with the incoming phonabet input." = "該聲調亦會嘗試與接下來輸入的注音相組合。"; "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "聲調符號。敲 Enter 以遞交。\n敲空格鍵以插入組字區。"; "CHS / CHT Input Mode Switch" = "簡體/繁體中文輸入模式切換";