diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-02-07 20:48:57 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-02-07 20:48:57 +0100 |
commit | 0900a0139ebeac3f66b185c9f4271c93b498eb16 (patch) | |
tree | c772d7fbea7ec3fa16c0d23dd110330ed8f165b5 /src/webview/spellchecker.js | |
parent | fix(Service): Improve focus when switching services (diff) | |
download | ferdium-app-0900a0139ebeac3f66b185c9f4271c93b498eb16.tar.gz ferdium-app-0900a0139ebeac3f66b185c9f4271c93b498eb16.tar.zst ferdium-app-0900a0139ebeac3f66b185c9f4271c93b498eb16.zip |
Spellcheck language autodetection
First prototype is based on slack
Diffstat (limited to 'src/webview/spellchecker.js')
-rw-r--r-- | src/webview/spellchecker.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/webview/spellchecker.js b/src/webview/spellchecker.js index becaed449..c711382be 100644 --- a/src/webview/spellchecker.js +++ b/src/webview/spellchecker.js | |||
@@ -3,6 +3,7 @@ import { SpellCheckerProvider } from 'electron-hunspell'; | |||
3 | import path from 'path'; | 3 | import path from 'path'; |
4 | 4 | ||
5 | import { DICTIONARY_PATH } from '../config'; | 5 | import { DICTIONARY_PATH } from '../config'; |
6 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | ||
6 | 7 | ||
7 | const debug = require('debug')('Franz:spellchecker'); | 8 | const debug = require('debug')('Franz:spellchecker'); |
8 | 9 | ||
@@ -82,3 +83,13 @@ export function disable() { | |||
82 | currentDict = null; | 83 | currentDict = null; |
83 | } | 84 | } |
84 | } | 85 | } |
86 | |||
87 | export function getSpellcheckerLocaleByFuzzyIdentifier(identifier) { | ||
88 | const locales = Object.keys(SPELLCHECKER_LOCALES).filter(key => key.split('-')[0] === identifier); | ||
89 | |||
90 | if (locales.length >= 1) { | ||
91 | return locales[0]; | ||
92 | } | ||
93 | |||
94 | return null; | ||
95 | } | ||