#7994 closed defect (bug) (fixed)
Language files for TinyMCE dialogs aren't loaded for official TinyMCE plugins (like advlink)
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.7 | Priority: | normal |
| Severity: | normal | Version: | 2.7 |
| Component: | TinyMCE | Keywords: | |
| Focuses: | Cc: |
Description
I use a WordPress plugin I've written that adds a few TinyMCE plugins not installed as standard by WP. I noticed that [9353] prevents the strings being loaded for the plugins that have popups. Attached is a screenshot of the advlink popup in action showing the problem.
Unwinding [9353] corrects the problem so I can confirm that's the changeset that introduces the behaviour.
The advlink plugin (along the other TinyMCE plugins that have popup dialogs I've looked at) have in the 'langs' subfolder 'en_dlg.js'. If I rename that file to 'en.js' and reload WP then when I click the link button while editing a post the language strings are loaded properly.
I can see in [9353] that while en.js is searched for, en_dlg.js isn't. Worth noting that some plugins have both en.js and en_dlg.js.
Attachments (1)
Change History (11)
#2
@
17 years ago
Ah cool, wasn't sure if it was a bug or as intended. I did notice the mce_external_languages filter and that was my next port of call but thought I'd mention it anyway!
#4
@
17 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Ha! About drove myself mad with this one
$path = preg_replace( '|.+?' . basename(WP_PLUGIN_URL) . '|', '', $plugurl );
Might a tad greedy. I can make changes to my plugins for it, but you make a WordPress plugin and organize TinyMCE Plugins into a subdirectory that has a name something like "tinymce_plugins" then the preg_replace will strip out everything up to plugins.
http://thesite.com/wp-content/plugins/tiny_mce_test/tinymce_plugins/xhtmlxtras
Becomes:
/home/thesite/wp-content/plugins/xhtmlxtras/langs/
A large hunk of the path "tiny_mce_test/tinymce_plugins/" gets parsed out.
#6
@
17 years ago
Switching back to replacing WP_PLUGIN_URL with WP_PLUGIN_DIR should fix this. Still this is the fall-back method of loading translations in TinyMCE, the preferred method is to use the 'mce_external_languages' filter.
#7
@
17 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
One more you should be aware of! The realpath function will strip that ending "/" you added to the $path.
$path = WP_PLUGIN_DIR . $path . '/langs/';
if ( function_exists('realpath') )
$path = realpath($path);
Becomes: WP_PLUGIN_DIR/$path/langs
Wasn't sure how you wanted to handle that or I would have added a patch. To either remove the slash and add slashes to the later is_file statements. Or add the slash to $path after realpath.
There is a filter
apply_filters('mce_external_languages', array());for loading languages for external TinyMCE plugins that can be used also to ensure en.js and en_dlg.js are loaded when the selected translation is not available. Unfortunately it seems only a few WordPress plugins are using it.
Will add the check for [language]_dlg.js to the current function to cover the rest.