Changeset 1655 in subversion


Ignore:
Timestamp:
Aug 18, 2008 8:00:05 AM (5 years ago)
Author:
thomasb
Message:

Set defaults for 'spellcheck_languages' and make sure the user language is set correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r1651 r1655  
    377377  } 
    378378 
    379   $tinylang = substr($_SESSION['language'], 0, 2); 
    380   if (!file_exists('program/js/tiny_mce/langs/'.$tinylang.'.js')) 
     379  $lang = $tinylang = strtolower(substr($_SESSION['language'], 0, 2)); 
     380  if (!file_exists(INSTALL_PATH . 'program/js/tiny_mce/langs/'.$tinylang.'.js')) 
    381381    $tinylang = 'en';  
    382382 
     
    404404  // include GoogieSpell 
    405405  if (!empty($CONFIG['enable_spellcheck'])) { 
    406     $googie_lang_set = $editor_lang_set = ''; 
    407     if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages'])) { 
    408       $googie_lang_set = "googie.setLanguages(".json_serialize($CONFIG['spellcheck_languages']).");\n"; 
    409       foreach ($CONFIG['spellcheck_languages'] as $key => $name) 
    410         $editor_lang_set .= ($editor_lang_set ? ',' : '') . ($key == $tinylang ? '+' : '') . JQ($name).'='.JQ($key); 
     406    $spellcheck_langs = (array)$RCMAIL->config->get('spellcheck_languages', array('da'=>'Dansk', 'de'=>'Deutsch', 'en' => 'English', 'es'=>'Español', 'fr'=>'Français', 'it'=>'Italiano', 'nl'=>'Nederlands', 'pl'=>'Polski', 'pt'=>'Português', 'fi'=>'Suomi', 'sv'=>'Svenska')); 
     407    if (!$spellcheck_langs[$lang]) 
     408      $lang = 'en'; 
     409     
     410    $editor_lang_set = array(); 
     411    foreach ($spellcheck_langs as $key => $name) { 
     412      $editor_lang_set[] = ($key == $lang ? '+' : '') . JQ($name).'='.JQ($key); 
    411413    } 
    412414     
     
    418420      "googie.lang_close = \"%s\";\n". 
    419421      "googie.lang_revert = \"%s\";\n". 
    420       "googie.lang_no_error_found = \"%s\";\n%s". 
     422      "googie.lang_no_error_found = \"%s\";\n". 
     423      "googie.setLanguages(%s);\n". 
    421424      "googie.setCurrentLanguage('%s');\n". 
    422425      "googie.decorateTextarea('%s');\n". 
     
    428431      JQ(Q(rcube_label('revertto'))), 
    429432      JQ(Q(rcube_label('nospellerrors'))), 
    430       $googie_lang_set, 
    431       substr($_SESSION['language'], 0, 2), 
     433      json_serialize($spellcheck_langs), 
     434      $lang, 
    432435      $attrib['id'], 
    433436      JS_OBJECT_NAME), 'foot'); 
    434437 
    435438    rcube_add_label('checking'); 
    436     $OUTPUT->set_env('spellcheck_langs', $editor_lang_set); 
     439    $OUTPUT->set_env('spellcheck_langs', join(',', $editor_lang_set)); 
    437440  } 
    438441  
Note: See TracChangeset for help on using the changeset viewer.