diff --git a/wp-includes/js/tinymce/tiny_mce_gzip.php b/wp-includes/js/tinymce/tiny_mce_gzip.php index 18a290aea8..c3af23ddd1 100644 --- a/wp-includes/js/tinymce/tiny_mce_gzip.php +++ b/wp-includes/js/tinymce/tiny_mce_gzip.php @@ -76,15 +76,32 @@ // Load theme, language pack and theme language packs $theme = apply_filters('mce_theme', 'advanced'); + echo wp_compact_tinymce_js(file_get_contents(realpath("themes/" . $theme . "/editor_template.js"))); - echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/en.js"))); - echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/en.js"))); + + // Get the WordPress locale + $locale = get_locale(); + + $themeLanguageFile = realpath("themes/" . $theme . "/langs/" . $locale . ".js"); + + if (!file_exists($themeLanguageFile)) + $themeLanguageFile = realpath("themes/" . $theme . "/langs/en.js"); + echo wp_translate_tinymce_lang(file_get_contents($themeLanguageFile)); + + $tinymceLanguageFile = realpath("langs/" . $locale . ".js"); + + if (!file_exists($tinymceLanguageFile)) + $tinymceLanguageFile = realpath("langs/en.js"); + echo wp_translate_tinymce_lang(file_get_contents($tinymceLanguageFile)); // Load all plugins and their language packs - $plugins = apply_filters('mce_plugins', array('wordpress', 'autosave', 'wphelp')); + $plugins = apply_filters('mce_plugins', array('wordpress', 'autosave','wphelp')); + foreach ($plugins as $plugin) { $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin.js"); - $languageFile = realpath("plugins/" . $plugin . "/langs/en.js"); + $languageFile = realpath("plugins/" . $plugin . "/langs/" . $locale . ".js"); + if (!file_exists($languageFile)) + $languageFile = realpath("plugins/" . $plugin . "/langs/en.js"); if ($pluginFile) echo file_get_contents($pluginFile); @@ -105,7 +122,7 @@ . 'title[dir