Closed Bug 1559789 Opened 5 years ago Closed 5 years ago

Align chat spellcheck with compose spellcheck so each chat can have its own language

Categories

(Thunderbird :: Instant Messaging, enhancement)

enhancement
Not set
normal

Tracking

(thunderbird68 fixed, thunderbird69 fixed)

RESOLVED FIXED
Thunderbird 69.0
Tracking Status
thunderbird68 --- fixed
thunderbird69 --- fixed

People

(Reporter: jorgk-bmo, Assigned: jorgk-bmo)

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1556203 +++

I noticed that chat still uses stone-age spelling while working on the bug above. Also, chatting with Richard in German always marks everything as misspelled. Changing the private chat to German changes the overall preference which is undesired.

We have the technology in the box to set individual languages on individual elements and de-couple from the global preference since TB 38.

Also see Florian's comment in bug 1556203 comment #11. Clearly, setting the language for a conversation shouldn't affect the rest of the system.

Easy port of this stuff:
https://searchfox.org/comm-central/rev/18d2a7176c129e82ade9dce1c729a0a58c095124/mail/components/compose/content/MsgComposeCommands.js#2867
https://searchfox.org/comm-central/rev/18d2a7176c129e82ade9dce1c729a0a58c095124/mail/components/compose/content/MsgComposeCommands.js#6624
https://searchfox.org/comm-central/rev/18d2a7176c129e82ade9dce1c729a0a58c095124/mail/components/compose/content/MsgComposeCommands.js#6671

Attachment #9072514 - Flags: review?(acelists)

Testing notes:
Install three dictionaries, select one of them in the compose/spelling settings.

Start a new conversation, language should be set to the default. Change language to something else.
Start another conversation, language should be set to the default. Change language to the third dictionary.

Switch back to the previous conversation, check that language is still what it was. Check that compose/spelling setting has not changed.
Switch to a mail tab, then back to the conversations and check the languages again.

Severity: major → normal

OK, some background info. Back in the TB 38 days, we implemented that "mail editor mask":
https://searchfox.org/mozilla-central/search?q=eEditorMailMask&case=false&regexp=false&path=EditorSpellCheck.cpp

In particular, the pref spellchecker.dictionary is NOT set when the user changes the language in this block controlled by if (!(flags & nsIPlaintextEditor::eEditorMailMask))
https://searchfox.org/mozilla-central/rev/b3b401254229f0a26f7ee625ef5f09c6c31e3949/editor/spellchecker/EditorSpellCheck.cpp#567

Now, since the users choice is not recorded in the pref, there needs to be another mechanism to communicate that change, and that's here:
https://searchfox.org/mozilla-central/search?q=spellcheck-changed&case=false&regexp=false&path=

When we get that notification, we know the user changed the language, and we set the "lang" attribute on the element which lets Gecko know which dictionary to use for the spellcheck:
https://searchfox.org/mozilla-central/rev/b3b401254229f0a26f7ee625ef5f09c6c31e3949/editor/spellchecker/EditorSpellCheck.cpp#731

Looks like the code has changes since I last worked on it in 2015-2016.

It's all working in compose windows since TB 38, only that they are more complicated as they have a status display and a spelling button which need to be kept in sync, and there is also the "stand-alone" spellchecker. So the chat stuff only needs the three functional block I ported.

Comment on attachment 9072514 [details] [diff] [review]
align-chat-spellcheck-with-compose.patch

Review of attachment 9072514 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks, for the explanation.
This works for me fine.
I just slightly worry what other behaviour may (will) be tacked onto the Ci.nsIPlaintextEditor.eEditorMailMask flag that we might not want to chat textarea in the future.
Attachment #9072514 - Flags: review?(acelists) → review+

Thanks, https://searchfox.org/mozilla-central/search?q=eEditorMailMask&case=false&regexp=false&path= doesn't show anything risky and M-C wouldn't add more code controlled by eEditorMailMask without letting us know.

Attachment #9072514 - Flags: approval-comm-beta+

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/a3afad972033
Align chat spellcheck with compose spellcheck so each chat can have its own language. r=aceman

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 69.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: