Changeset 1403

Show
Ignore:
Timestamp:
12/07/07 00:28:21 (1 year ago)
Author:
rho
Message:

Improved spell language selection based on user settings

Signed-off: Rolando Espinoza La fuente <rho@prosoftpeople.com>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/tinymce/tinymce_js.php

    r1304 r1403  
    3434         
    3535        // gzip thingy should only assemble plugins we're actually using 
    36         $plugins = 'spellchecker,emotions,contextmenu,preview,style,searchreplace,autosave,safari'; 
     36        $plugins = 'spellchecker,emotions,contextmenu,preview,style,searchreplace,safari'; 
    3737        //plugins : 'style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,spellchecker', 
    3838         
     
    4747        $elementstring = implode(",", $elements); 
    4848         
    49          
    50          
     49        // auto select spellchecker language based on $lang 
     50        $available_langs = array('English=en','Dutch=nl','German=de', 
     51                                 'Spanish=es','Danish=dk','Swedish=sv',          
     52                                 'French=fr','Japanese=jp'); 
     53        $spell_langs = array(); 
     54        $spell_found = false; 
     55 
     56        foreach ($available_langs as $slang) { 
     57            $lang_code = substr($slang,strlen($slang)-2,2); 
     58 
     59            if ($lang_code == $lang) { 
     60                $spell_langs[] = '+' . $slang; 
     61                $spell_found = true; 
     62            } else { 
     63                $spell_langs[] = $slang; 
     64            } 
     65        } 
     66 
     67        $spellcheck_languages = implode(',', $spell_langs); 
     68 
     69        // Set default first language if lang not found in spell langs 
     70        if (!$spell_found) { 
     71            $spellcheck_languages = '+' . $spellcheck_languages; 
     72        } 
     73 
    5174        $metatags .= <<< END 
    5275    <script language="javascript" type="text/javascript" src="$url/mod/tinymce/lib/jscripts/tiny_mce/tiny_mce_gzip.js"></script> 
     
    5679        plugins : '$plugins', 
    5780        themes : 'advanced', 
    58         languages : 'en,$lang', 
     81        language : '$lang', 
    5982        disk_cache : true, 
    6083        debug : false 
     
    83106        theme_advanced_source_editor_width : "400", 
    84107        theme_advanced_source_editor_height : "400", 
    85         spellchecker_languages : "+English=en,Dutch=nl,German=de,Spanish=es,Danish=dk,Swedish=sv,French=fr,Japanese=jp", 
     108        spellchecker_languages : "$spellcheck_languages", 
    86109        document_base_url : "$url", 
    87110        fullscreen_settings : {