diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2013-10-18 12:50:25 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2013-10-18 12:50:25 +0200 |
commit | c344b64f13e7aa3c87c423cc14e57536d28c40b6 (patch) | |
tree | dc64f304fc4cb0082f45d2cb560259ec22acee47 /program/lib/Roundcube/rcube_spellcheck_pspell.php | |
parent | 70c7df8faa5a9023a2773dc5a38932f1ad3a84aa (diff) |
Get supported spell-check languages from the configured backend; replace suspended google spell service with our new service at spell.roundcube.net
Diffstat (limited to 'program/lib/Roundcube/rcube_spellcheck_pspell.php')
-rw-r--r-- | program/lib/Roundcube/rcube_spellcheck_pspell.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/program/lib/Roundcube/rcube_spellcheck_pspell.php b/program/lib/Roundcube/rcube_spellcheck_pspell.php index ce089ed8f..b12684e43 100644 --- a/program/lib/Roundcube/rcube_spellcheck_pspell.php +++ b/program/lib/Roundcube/rcube_spellcheck_pspell.php @@ -30,6 +30,35 @@ class rcube_spellcheck_pspell extends rcube_spellcheck_engine private $matches = array(); /** + * Return a list of languages supported by this backend + * + * @see rcube_spellcheck_engine::languages() + */ + function languages() + { + $defaults = array('en'); + $langs = array(); + + // get aspell dictionaries + exec('aspell dump dicts', $dicts); + if (!empty($dicts)) { + $seen = array(); + foreach ($dicts as $lang) { + $lang = preg_replace('/-.*$/', '', $lang); + $langc = strlen($lang) == 2 ? $lang.'_'.strtoupper($lang) : $lang; + if (!$seen[$langc]++) + $langs[] = $lang; + } + $langs = array_unique($langs); + } + else { + $langs = $defaults; + } + + return $langs; + } + + /** * Initializes PSpell dictionary */ private function init() |