Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spellcheck language switcher #13317

Closed
geckolinux opened this issue Apr 22, 2020 · 9 comments · Fixed by matrix-org/matrix-react-sdk#5452
Closed

Spellcheck language switcher #13317

geckolinux opened this issue Apr 22, 2020 · 9 comments · Fixed by matrix-org/matrix-react-sdk#5452
Assignees

Comments

@geckolinux
Copy link

Hi there, would it be possible to add an item to the spellcheck context menu to change to a different language? This is important for multilingual users. Bonus points if it remembers the language for each room and/or user. Thanks!

@t3chguy
Copy link
Member

t3chguy commented Apr 22, 2020

Related #7773

@geckolinux
Copy link
Author

Hi again, wouldn't multi-language spellchecking come along "for free" by virtue of being an Electron app? Chromium for example has this:

Screenshot_2020-10-12_08-20-49

@t3chguy
Copy link
Member

t3chguy commented Oct 12, 2020

Yes, but the UI to manage it does not.

@SimonBrandner
Copy link
Contributor

I've been looking into adding multi-language spell-check recently. This seems to be related to this issue.

UI

I would go for something similar to the way email addresses and phone numbers are handled.

Electron

Electron already seems to support this. So does the function in element-web which talks to Electron through IPC and sets the language for the spell checker. Thus implementing this in the desktop app shouldn't be problematic.

Browser

I don't really know how to implement this in the browser. Does anyone know?

Implementation

I could probably implement this, at least on the desktop. I would go about in the following way:

  • Add UI as I described before. The UI would include a comment saying that it is currently supported only on the desktop. Even better would be hiding this option in the browser. Though I don't know how to check if the app is running in Electron. I'll take a look.
  • Add setting for storing a list of languages to spell-check. If it would be empty the spell check could be disabled to satisfy Option to configure and disable spellcheck missing #13543.
  • Add a special case for setting spell-check language in electron-main.js

This would solve this problem for the desktop app and leave space for later implementation in the browser.

Should I attempt to implement this? Even if it was only for the Desktop, for now?

@geckolinux
Copy link
Author

Thanks a lot @SimonBrandner , I'd really appreciate any implementation, even if only for the Desktop.

I don't really know how to implement this in the browser. Does anyone know?

This might be a bit of a long stretch, but the TinyMCE WYSIWYG editor has an option to allow the browser's native right-click context menu, which includes the browser's native spellchecker:

https://www.tiny.cloud/docs/general-configuration-guide/spell-checking/

Maybe you could have a look at their JS code for that? Sorry if this is a totally irrelevant suggestion.

@SimonBrandner
Copy link
Contributor

SimonBrandner commented Nov 28, 2020

browser's native right-click context menu, which includes the browser's native spellchecker

@geckolinux I think I failed to explain what I wanted to do.

The right-click menu seems to work fine for me in the browser (at least in Firefox).

What I want to implement is a spell-checker that will check multiple languages at once. Meaning it wouldn't mark any part of Hello world; Hola Mundo incorrect if I selected that I want it to check for English and Spanish.

I find this much more friendly because I sometimes use multiple languages in one message and even if I didn't the right-click menu is just not very elegant, at least not from my perspective. This also eliminates the need for having per-room spell-check language.

Electron allows for:

mainWindow.webContents.session.setSpellCheckerLanguages(languages)

where languages are an array. The thing is I don't know how to do this in the browser. I don't even know if it is possible. The browser has a similar thing but it dosn'ŧ accept an array, at least I don't think it does.

@SimonBrandner
Copy link
Contributor

I made a draft PR.

@SimonBrandner
Copy link
Contributor

The PR is ready

@geckolinux
Copy link
Author

Nice! Thank you very much!

@jryans jryans added I18n and removed A-I18n labels Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants