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

Add multi language spell check #15851

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/vector/platform/ElectronPlatform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@ export default class ElectronPlatform extends VectorBasePlatform {
return 'Electron Platform'; // no translation required: only used for analytics
}

/**
* Return true if platform supports multi-language
* spell-checking, otherwise false.
*/
supportsMultiLanguageSpellCheck(): boolean {
// Electron uses OS spell checking on macOS, so no need for in-app options
if (isMac) return false;
SimonBrandner marked this conversation as resolved.
Show resolved Hide resolved
return true;
SimonBrandner marked this conversation as resolved.
Show resolved Hide resolved
}

setNotificationCount(count: number) {
if (this.notificationCount === count) return;
super.setNotificationCount(count);
Expand Down Expand Up @@ -488,13 +498,21 @@ export default class ElectronPlatform extends VectorBasePlatform {
return this.eventIndexManager;
}

setLanguage(preferredLangs: string[]) {
this._ipcCall('setLanguage', preferredLangs).catch(error => {
console.log("Failed to send setLanguage IPC to Electron");
setSpellCheckLanguages(preferredLangs: string[]) {
this._ipcCall('setSpellCheckLanguages', preferredLangs).catch(error => {
console.log("Failed to send setSpellCheckLanguages IPC to Electron");
console.error(error);
});
}

async getSpellCheckLanguages(): Promise<string[]> {
return this._ipcCall('getSpellCheckLanguages');
}

async getAvailableSpellCheckLanguages(): Promise<string[]> {
return this._ipcCall('getAvailableSpellCheckLanguages');
}

getSSOCallbackUrl(fragmentAfterLogin: string): URL {
const url = super.getSSOCallbackUrl(fragmentAfterLogin);
url.protocol = "element";
Expand Down