From be9aacaa5296dfca63fb3a01c2dc52538d1546aa Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Sat, 17 Nov 2012 12:31:31 -0500
Subject: [PATCH] Bring back lost localization for the about page

---
 program/include/rcube_spellchecker.php |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/program/include/rcube_spellchecker.php b/program/include/rcube_spellchecker.php
index f38720b..30d15d7 100644
--- a/program/include/rcube_spellchecker.php
+++ b/program/include/rcube_spellchecker.php
@@ -25,7 +25,8 @@
 /**
  * Helper class for spellchecking with Googielspell and PSpell support.
  *
- * @package Core
+ * @package    Framework
+ * @subpackage Utils
  */
 class rcube_spellchecker
 {
@@ -56,13 +57,6 @@
         $this->rc     = rcube::get_instance();
         $this->engine = $this->rc->config->get('spellcheck_engine', 'googie');
         $this->lang   = $lang ? $lang : 'en';
-
-        if ($this->engine == 'pspell' && !extension_loaded('pspell')) {
-            rcube::raise_error(array(
-                'code' => 500, 'type' => 'php',
-                'file' => __FILE__, 'line' => __LINE__,
-                'message' => "Pspell extension not available"), true, true);
-        }
 
         $this->options = array(
             'ignore_syms' => $this->rc->config->get('spellcheck_ignore_syms'),
@@ -131,12 +125,12 @@
 
 
     /**
-     * Returns mispelled words
+     * Returns misspelled words
      *
      * @param string $text The content for spellchecking. If empty content
      *                     used for check() method will be used.
      *
-     * @return array List of mispelled words
+     * @return array List of misspelled words
      */
     function get_words($text = null, $is_html=false)
     {
@@ -171,7 +165,7 @@
 
 
     /**
-     * Returns checking result (mispelled words with suggestions)
+     * Returns checking result (misspelled words with suggestions)
      *
      * @return array Spellchecking result. An array indexed by word.
      */
@@ -235,8 +229,9 @@
             else if (!pspell_check($this->plink, $word)) {
                 $suggestions = pspell_suggest($this->plink, $word);
 
-	            if (sizeof($suggestions) > self::MAX_SUGGESTIONS)
-	                $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
+                if (sizeof($suggestions) > self::MAX_SUGGESTIONS) {
+                    $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
+                }
 
                 $matches[] = array($word, $pos, $len, null, $suggestions);
             }
@@ -249,7 +244,7 @@
 
 
     /**
-     * Returns the mispelled words
+     * Returns the misspelled words
      */
     private function _pspell_words($text = null, $is_html=false)
     {
@@ -263,7 +258,7 @@
                 return array();
             }
 
-            // With PSpell we don't need to get suggestions to return mispelled words
+            // With PSpell we don't need to get suggestions to return misspelled words
             if ($is_html) {
                 $text = $this->html2text($text);
             }
@@ -295,7 +290,7 @@
 
 
     /**
-     * Returns suggestions for mispelled word
+     * Returns suggestions for misspelled word
      */
     private function _pspell_suggestions($word)
     {
@@ -321,6 +316,16 @@
     private function _pspell_init()
     {
         if (!$this->plink) {
+            if (!extension_loaded('pspell')) {
+                $this->error = "Pspell extension not available";
+                rcube::raise_error(array(
+                    'code' => 500, 'type' => 'php',
+                    'file' => __FILE__, 'line' => __LINE__,
+                    'message' => $this->error), true, false);
+
+                return;
+            }
+
             $this->plink = pspell_new($this->lang, null, null, RCMAIL_CHARSET, PSPELL_FAST);
         }
 

--
Gitblit v1.9.1