Changeset 4817 in subversion


Ignore:
Timestamp:
May 30, 2011 1:08:47 PM (2 years ago)
Author:
alec
Message:
  • Fix setting language for spellchecker on spellcheck_before_send
Location:
trunk/roundcubemail/program
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_spellchecker.php

    r4815 r4817  
    5353        $this->rc = rcmail::get_instance(); 
    5454        $this->engine = $this->rc->config->get('spellcheck_engine', 'googie'); 
    55         $this->lang = $lang; 
     55        $this->lang = $lang ? $lang : 'en'; 
    5656 
    5757        if ($this->engine == 'pspell' && !extension_loaded('pspell')) { 
     
    156156 
    157157        $out .= '</spellresult>'; 
     158 
     159        return $out; 
     160    } 
     161 
     162 
     163    /** 
     164     * Returns checking result (mispelled words with suggestions) 
     165     * 
     166     * @return array Spellchecking result. An array indexed by word. 
     167     */ 
     168    function get() 
     169    { 
     170        $result = array(); 
     171 
     172        foreach ($this->matches as $item) { 
     173            if ($this->engine == 'pspell') { 
     174                $word = $item[0]; 
     175            } 
     176            else { 
     177                $word = mb_substr($this->content, $item[1], $item[2], RCMAIL_CHARSET); 
     178            } 
     179            $result[$word] = is_array($item[4]) ? implode("\t", $item[4]) : $item[4]; 
     180        } 
    158181 
    159182        return $out; 
  • trunk/roundcubemail/program/js/app.js

    r4793 r4817  
    891891 
    892892        // all checks passed, send message 
    893         var form = this.gui_objects.messageform, 
     893        var lang = this.spellcheck_lang(), 
     894          form = this.gui_objects.messageform, 
    894895          msgid = this.set_busy(true, 'sendingmessage'); 
    895896 
     
    897898        form._draft.value = ''; 
    898899        form.action = this.add_url(form.action, '_unlock', msgid); 
     900        form.action = this.add_url(form.action, '_lang', lang); 
    899901        form.submit(); 
    900902 
     
    30033005    this.spellcheck_ready = (s == 'ready' || s == 'no_error_found'); 
    30043006    this.enable_command('spellcheck', this.spellcheck_ready); 
     3007  }; 
     3008 
     3009  // get selected language 
     3010  this.spellcheck_lang = function() 
     3011  { 
     3012    var ed; 
     3013    if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins.spellchecker) { 
     3014      return ed.plugins.spellchecker.selectedLang; 
     3015    } 
     3016    else if (this.env.spellcheck) { 
     3017      return GOOGIE_CUR_LANG; 
     3018    } 
    30053019  }; 
    30063020 
  • trunk/roundcubemail/program/js/googiespell.js

    r4477 r4817  
    1111*/ 
    1212 
    13 var SPELL_CUR_LANG = null; 
    14 var GOOGIE_DEFAULT_LANG = 'en'; 
     13var GOOGIE_CUR_LANG, 
     14    GOOGIE_DEFAULT_LANG = 'en'; 
    1515 
    1616function GoogieSpell(img_dir, server_url) { 
     
    261261            } else { 
    262262                    if (!ref.custom_no_spelling_error) 
    263                         ref.flashNoSpellingErrorState(); 
    264                 else 
    265                 ref.custom_no_spelling_error(ref); 
     263                        ref.flashNoSpellingErrorState(); 
     264                else 
     265                        ref.custom_no_spelling_error(ref); 
    266266            } 
    267267            ref.removeIndicator(); 
  • trunk/roundcubemail/program/steps/mail/sendmail.inc

    r4816 r4817  
    414414    && empty($_SESSION['compose']['spell_checked']) 
    415415  ) { 
    416     $spellchecker = new rcube_spellchecker(); 
     416    $spellchecker = new rcube_spellchecker(get_input_value('_lang', RCUBE_INPUT_GPC)); 
    417417    $spell_result = $spellchecker->check($message_body, $isHtml); 
    418418 
Note: See TracChangeset for help on using the changeset viewer.