Fix live spell check using the English dictionary for other languages#12289
Fix live spell check using the English dictionary for other languages#12289muaz978 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.
|
@niksedk would you have a look at this one when you get a chance? It is still clean and mergeable against main, and it is a small change: two lines in The short version: live spell check picks its dictionary by auto detecting the subtitle language, but the helper it used falls back to English when the subtitle is empty. Setup runs at startup before any file is open, so the checker was armed with the English dictionary, and content arriving without a file open (a speech to text transcription, a video OCR result) never re-evaluated it. An Arabic transcription therefore came back with every word underlined. The fix uses the variant of the helper that returns null instead of falling back to English, so an empty subtitle leaves live spell check off rather than arming it with the wrong dictionary, and the two result paths re-run the setup the same way opening a file does. Tested on macOS in all three directions: Arabic transcription has no false underlines, opening an English subtitle behaves as before, and an English transcription now enables live spell check correctly (which previously only worked by accident of the English fallback). No rush, and happy to adjust the approach if you would rather handle the empty subtitle case differently. |
|
Thanks for merging the RTL scroll bar fix just now, much appreciated. Whenever you have a moment, @niksedk, this one (#12289) is the last from the recent batch still open. It is still clean and mergeable against main, and small (+19/-2): two lines in No rush at all, and I am happy to adjust the empty subtitle handling if you would prefer a different approach. |
|
I will try to look at it soon. This just require some testing.... |
|
Thanks. On the testing side, I ran it on six different YouTube videos across Arabic, English and Turkish, and all of them passed: Arabic transcriptions no longer come back with every word underlined, English still behaves as before, and an English transcription now enables live spell check correctly. I only attached two of the six as examples above to keep it short. Happy to share more captures or a specific case if that would help. |


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: