Fix live spell check using the English dictionary for other languages#12289
Open
muaz978 wants to merge 1 commit into
Open
Fix live spell check using the English dictionary for other languages#12289muaz978 wants to merge 1 commit into
muaz978 wants to merge 1 commit into
Conversation
Live spell check picks its dictionary by auto detecting the subtitle's language, but the detection helper falls back to English when the subtitle is empty or the language cannot be determined. At startup the setup runs before any file is loaded, so with only the English dictionary installed the spell checker was armed with English. Content that arrives without a file open, such as a speech to text transcription or a video OCR result, never re-evaluated the choice, so an Arabic transcription was spell checked against the English dictionary and every single word was underlined as misspelled. The setup now uses the detection variant that returns null instead of the English fallback (an empty or undetectable subtitle disables live spell check instead of arming it), and the transcription and video OCR result paths re-evaluate the dictionary after inserting their content, the same way opening a file does. This also means a fresh English transcription now gets live spell check enabled, which previously only happened by accident.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem
With live spell check enabled and only the English dictionary installed, an Arabic speech to text transcription came back with every single word underlined in red, in the subtitle grid and in the text box.
Cause
Live spell check picks its dictionary by auto detecting the subtitle's language, but the detection helper used here falls back to English when the subtitle is empty or undetectable. The setup runs at startup before any file is loaded, so the spell checker was armed with the English dictionary against an empty subtitle. Content that arrives without a file open, such as a speech to text transcription or a video OCR result, never re-evaluated that choice, so Arabic text was spell checked against the English dictionary.
Fix
Two small changes in MainViewModel:
SetupLiveSpellChecknow usesAutoDetectGoogleLanguageOrNull, which returns null instead of the English fallback. An empty or undetectable subtitle disables live spell check instead of arming it with the wrong dictionary. Opening a file re-evaluates as before.SetupLiveSpellCheck()after inserting their content, the same way opening a file does.A side effect worth noting: a fresh English transcription now gets live spell check enabled correctly, which previously only happened by accident of the English fallback.
Testing
Verified on macOS (Apple Silicon), all three directions: