From 7b3509fcdf1c3bb7165bab2d05bc3979e094c1df Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 7 Dec 2022 21:18:41 +0800 Subject: [PATCH] SessionCtl // Stop receiving inputs until factory dictionary is loaded. --- Source/Modules/SessionCtl_HandleEvent.swift | 11 +++++++++++ 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, 16 insertions(+) diff --git a/Source/Modules/SessionCtl_HandleEvent.swift b/Source/Modules/SessionCtl_HandleEvent.swift index fae04304..56e72625 100644 --- a/Source/Modules/SessionCtl_HandleEvent.swift +++ b/Source/Modules/SessionCtl_HandleEvent.swift @@ -103,6 +103,17 @@ extension SessionCtl { /// 沒有文字輸入客體的話,就不要再往下處理了。 guard let inputHandler = inputHandler, client() != nil else { return false } + /// 除非核心辭典有載入,否則一律蜂鳴。 + if !LMMgr.currentLM.isCoreLoaded { + var newState: IMEStateProtocol = IMEState.ofEmpty() + newState.tooltip = NSLocalizedString("Factory dictionary not loaded yet.", comment: "") + "  " + newState.tooltipDuration = 1.85 + newState.data.tooltipColorState = .redAlert + switchState(newState) + callError("CoreLM not loaded yet.") + return true + } + var eventToDeal = event // 如果是方向鍵輸入的話,就想辦法帶上標記資訊、來說明當前是縱排還是橫排。 diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index 30467147..dc6b8067 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -16,6 +16,7 @@ "Loading…" = "Loading…"; "Consolidate" = "Consolidate"; "Reload" = "Reload"; +"Factory dictionary not loaded yet." = "Factory dictionary not loaded yet."; "Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations." = "Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations."; "This editor only: Auto-reload modifications happened outside of this editor" = "This editor only: Auto-reload modifications happened outside of this editor"; "Please select Simplified / Traditional Chinese mode above." = "Please select Simplified / Traditional Chinese mode above."; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index 30467147..dc6b8067 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -16,6 +16,7 @@ "Loading…" = "Loading…"; "Consolidate" = "Consolidate"; "Reload" = "Reload"; +"Factory dictionary not loaded yet." = "Factory dictionary not loaded yet."; "Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations." = "Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations."; "This editor only: Auto-reload modifications happened outside of this editor" = "This editor only: Auto-reload modifications happened outside of this editor"; "Please select Simplified / Traditional Chinese mode above." = "Please select Simplified / Traditional Chinese mode above."; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index ccb7b633..687ca98d 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -16,6 +16,7 @@ "Loading…" = "読み込む中…"; "Consolidate" = "整理"; "Reload" = "再読込"; +"Factory dictionary not loaded yet." = "内蔵辞書はまだ読込中。"; "Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations." = "システム API 制限のため、一部の機能は macOS 10.15 と macOS 11 で提供できません。"; "This editor only: Auto-reload modifications happened outside of this editor" = "このエディターの外部からの編集結果をこのエディターに自動的に読み込む"; "Please select Simplified / Traditional Chinese mode above." = "まずは上記のメニューで簡体/繁体中国語モードをお選びください。"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index f86e3bf8..571e7e7c 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -16,6 +16,7 @@ "Loading…" = "正在载入…"; "Consolidate" = "整理"; "Reload" = "重新载入"; +"Factory dictionary not loaded yet." = "原厂辞典尚未完成载入。"; "Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations." = "因系统 API 限制,个别功能无法对 macOS 10.15 和 macOS 11 提供。"; "This editor only: Auto-reload modifications happened outside of this editor" = "仅限该编辑器:自动读入来自该编辑器外部的档案内容修改"; "Please select Simplified / Traditional Chinese mode above." = "请先借由上方选单选择简繁模式。"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 49372efa..02f0e7db 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -16,6 +16,7 @@ "Loading…" = "正在載入…"; "Consolidate" = "整理"; "Reload" = "重新載入"; +"Factory dictionary not loaded yet." = "原廠辭典尚未完成載入。"; "Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations." = "因系統 API 限制,個別功能無法對 macOS 10.15 和 macOS 11 提供。"; "This editor only: Auto-reload modifications happened outside of this editor" = "僅限該編輯器:自動讀入來自該編輯器外部的檔案內容修改"; "Please select Simplified / Traditional Chinese mode above." = "請先藉由上方選單選擇繁簡模式。";