Make WordPress Core

Changeset 3624


Ignore:
Timestamp:
03/06/2006 10:52:15 PM (19 years ago)
Author:
ryan
Message:

Language support for TinyMCE. Props capt_kirk and Stephen Chu. fixes #2476

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-includes/js/tinymce/tiny_mce_gzip.php

    r3613 r3624  
    7777    // Load theme, language pack and theme language packs
    7878    $theme = apply_filters('mce_theme', 'advanced');
     79
    7980    echo wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template.js")));
    80     echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/en.js")));
    81     echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/en.js")));
     81
     82    // Get the WordPress locale
     83    $locale = get_locale();
     84
     85    $themeLanguageFile = realpath("themes/" . $theme . "/langs/" . $locale . ".js");
     86
     87    if (!file_exists($themeLanguageFile))
     88        $themeLanguageFile = realpath("themes/" . $theme . "/langs/en.js");
     89    echo wp_translate_tinymce_lang(file_get_contents($themeLanguageFile));
     90
     91    $tinymceLanguageFile = realpath("langs/" . $locale . ".js");
     92
     93    if (!file_exists($tinymceLanguageFile))
     94        $tinymceLanguageFile = realpath("langs/en.js");
     95    echo wp_translate_tinymce_lang(file_get_contents($tinymceLanguageFile));
    8296
    8397    // Load all plugins and their language packs
    84     $plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp'));
     98    $plugins = apply_filters('mce_plugins', array('wordpress', 'autosave','wphelp'));
     99
    85100    foreach ($plugins as $plugin) {
    86101        $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin.js");
    87         $languageFile = realpath("plugins/" . $plugin . "/langs/en.js");
     102        $languageFile = realpath("plugins/" . $plugin . "/langs/" . $locale . ".js");
     103        if (!file_exists($languageFile))
     104            $languageFile = realpath("plugins/" . $plugin . "/langs/en.js");
    88105
    89106        if ($pluginFile)
     
    106123    else // Use a much smaller set
    107124        $valid_elements = '-a[id|href|title|rel],-strong/b,-em/i,-strike,-del,-u,p[class|align|dir],-ol,-ul,-li,br,img[class|src|alt|title|width|height|align],-sub,-sup,-blockquote[dir],-table[border|cellspacing|cellpadding|width|height|class|align|dir],thead[class|rowspan|width|height|align|valign|dir],tr[class|rowspan|width|height|align|valign|dir],th[dir|class|colspan|rowspan|width|height|align|valign|scope],td[dir|class|colspan|rowspan|width|height|align|valign],-div[dir|class|align],-span[class|align],-pre[class],-code[class],-address,-h1[class|align|dir],-h2[class|align|dir],-h3[class|align|dir],-h4[class|align|dir],-h5[class|align|dir],-h6[class|align|dir],hr';
    108     $valid_elements = apply_filters('mce_valid_elements', $valid_elements); 
     125    $valid_elements = apply_filters('mce_valid_elements', $valid_elements);
    109126    $plugins = implode($plugins, ',');
    110127    $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright' ,'separator', 'link', 'unlink', 'image', 'wordpress', 'separator', 'undo', 'redo', 'code', 'wphelp'));
Note: See TracChangeset for help on using the changeset viewer.