From 5ce70ede4b2f3e42276a8215d32af4c8dca026fb Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 6 Mar 2006 22:51:28 +0000 Subject: [PATCH] Language support for TinyMCE. Props capt_kirk and Stephen Chu. fixes #2476 git-svn-id: https://develop.svn.wordpress.org/trunk@3623 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/tinymce/tiny_mce_gzip.php | 27 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) 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