From c344b64f13e7aa3c87c423cc14e57536d28c40b6 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 18 Oct 2013 06:50:25 -0400
Subject: [PATCH] Get supported spell-check languages from the configured backend; replace suspended google spell service with our new service at spell.roundcube.net

---
 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 ce089ed..b12684e 100644
--- a/program/lib/Roundcube/rcube_spellcheck_pspell.php
+++ b/program/lib/Roundcube/rcube_spellcheck_pspell.php
@@ -30,6 +30,35 @@
     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()

--
Gitblit v1.9.1