Opened 10 years ago
Closed 10 years ago
#27797 closed defect (bug) (fixed)
Improve loading of TinyMCE translations
Reported by: | nacin | Owned by: | azaozz |
---|---|---|---|
Milestone: | 4.1 | Priority: | low |
Severity: | minor | Version: | |
Component: | TinyMCE | Keywords: | |
Focuses: | performance | Cc: |
Description
[28112] loads all translations even in English. In reality only about 10 strings diverge from the TinyMCE string in en_US, so we could speed things up with some creativity. (We're only talking a millisecond, however.)
Additionally, a lot of these strings are there only for plugins — we can check if the table plugin is added, and then immediately side-step 40 translations. The whole process takes about 4-5 milliseconds; we might be able to cut that in half if we exclude strings we don't need when that particular plugin isn't loaded.
TinyMCE 4.0 uses real English string fallbacks, so it's less of a problem if something doesn't get translated because custom plugin B is using official plugin A's strings.
This may fail when another instance of TinyMCE is created after loading the page. If that instance loads plugins that are not loaded in the initial instance, TinyMCE will load the plugin's JS but expects that the translations are already present. This changed in version 4.0. Now all translations for the default plugins are always loaded. In 3.x there were separate translation files for the plugins, now all are merged in one.
Right, we can output only strings that diverge from the default. This won't speed things up but will output less inline JS (the translated strings are outputted inline from PHP to avoid another request).