WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#3989 closed defect (bug) (fixed)

TinyMCE default language fails when get_locale() is empty for external plugins

Reported by: ev3rywh3re Owned by:
Milestone: 2.2 Priority: normal
Severity: normal Version: 2.1.2
Component: TinyMCE Keywords: tinymce, l10n
Focuses: Cc:

Description

I know there is probably an easy solution here, and it may my own fault for not following some proper guideline for language files.

When loading an external plugin that does not reside in /wp-includes/js/tinymce/plugins/ using a TinyMCE JS init something like:

plugins : "-g2image"
tinyMCE.loadPlugin('g2image', 'http://wierdplacefortinymceplugin.com/g2image/');

Language files for external plugins seem to be ignored if get_locale() returns a blank to the "language :" TinyMCE init in tiny_mce_config.php.

Here is a filtered work-around that works (NOT a PATCH):

function tinymce_locale_fix($locale) {
	if (strstr($_SERVER['REQUEST_URI'], 'tiny_mce_config')) {
		if ( $locale == '' ) {
			$locale = 'EN';
		}
	}
	return $locale; 
}

add_filter('locale', 'tinymce_locale_fix');

If you give the TinyMCE initArray a proper language it works. I don't really know if this is buried in the TinyMCE docs, and I just have-no-clue, but I thought I would post this here incase there is something that should be addressed in Wordpress.

Change History (3)

comment:1 @ev3rywh3re8 years ago

  • Version changed from 2.2 to 2.1.2

comment:2 @foolswisdom8 years ago

  • Milestone changed from 2.1.3 to 2.2

comment:3 @rob1n8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This was fixed before.

Note: See TracTickets for help on using tickets.