Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#5362 closed Bug (wontfix)

Non existent language files causes JavaScript errors

Reported by: AlexC Owned by:
Priority: Normal Milestone:
Component: General Version: 3.4.1
Keywords: Cc:

Description

If you set the 'language' configuration value to something which does not exist, 'foobar', for example - CKEditor fails to load and shows the following errors in Google Chrome:

Uncaught TypeError: Cannot read property 'options' of undefined

It also fails to load in every other browser, with similar errors (unable to get at the moment, a colleague should be getting these soon).

We ran across this because we uploaded CKEditor and then removed all language files apart from 'en.js' to save space, as we knew our users would never want other languages.

If no 'language' config value is provided, afaik it picks it up from the browser - and one of our developers had a different language, which resulting in this error.

It would be nicer imo to default to 'en' if the provided language file does not exist.

Change History (2)

comment:1 Changed 10 years ago by Alfonso Martínez de Lizarrondo

Resolution: wontfix
Status: newclosed

You can control the default language using config.language. As CKEditor is a client-side element, it can only find out that the requested language file doesn't exist by requesting it and then getting an error, that's a huge waste of resources and in some environments it can have bad consequences, so you must control the languages if you have deleted some of those files.

comment:2 Changed 9 years ago by Chris Graham

Version: 3.23.4.1

I am getting this error, but it is definitely not caused by a missing language pack. It only happens on a remote server, and with Google Chrome, and I think is related to a lot of files getting loaded up from the website itself. I believe somehow code is executing in the wrong order, so that the plugins initiate before the main language file has loaded. I guess this may be due to an assumption in your code about in what order the browser loads queued resources. I was able to workaround it by delaying ckeditor initialisation by 1 second. If I set a breakpoint on the error, CKEDITOR.lang.en.contextmenu is defined but l.lang is an empty object. I believe this may be due to in the moments after the breakpoint is set the browser finishing loading other JS files, but I'm not really sure. I would debug further but the CKEditor code is very complex and it's hard to work from the minimised version, and I just don't have any more time to throw at it I'm afraid. You guys probably can ascertain if there is some kind of assumed loading order that browsers may not actually hold true and if necessary make some kind of safety check before fully executing out-of-order scripts.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy