ovi.ro

ovi.ro

Solve: “m.lang.contextmenu is undefined” error message

I got this error while developing a website. It was odd the problema was not already reported, but that was because of the diferent language of the visitors.

The problem seems to be from the CKEditor language detection mechanism, I tried alerted

alert(CKEDITOR.lang.detect( 'en' )); // the result was 'en-gb'

The file in /ckeditor/lang/  was called ‘en.js’ so probably they expected the language code to be just ‘en’.

The fast solution was to add this in the CKEDITOR.editorConfig function  (config.js file)

if (CKEDITOR.lang.detect( 'en' ) == 'en-gb') {
	config.language = 'en';
}

There might be a better solution detecting all posibilities ‘en-gb’, ‘en-us’ etc. or with some Regexp like

if ( /en.*/.test("en-us") ) {
	config.language = 'en';
}