I am currently switching the plugin from TinyMCE 3.x to the new version of TinyMCE 4.0.26. I ran into serious problems trying to internationalize my plugin shortcuts.
In my plugin.js, I download the language pack by calling
tinymce.PluginManager.requireLangPack('myplugin');
with my i18n langs / de.js file looking something like this:
tinyMCE.addI18n('de', {
myplugin: {
button : 'Link einf\u00FCgen/bearbeiten',
title : 'Link einf\u00FCgen/bearbeiten'
}
});
When I access the static context
tinymce.i18n.data.myplugin
I see that both buttons and the variable name are available.
PROBLEM:
When calling editor.getLang ('myplugin.button'), I get {# myplugin.button} instead of the corresponding variable value.
After a little study of the source code, I found out that he expects the language code to exist within tinyMCE.i18n.data ..... which is not available
getLang: function(name, defaultVal) {
return (
this.editorManager.i18n[(this.settings.language || 'en') + '.' + name] ||
(defaultVal !== undefined ? defaultVal : '{#' + name + '}')
);
},
@see https://github.com/tinymce/tinymce/blob/4.0.26/js/tinymce/classes/Editor.js#L1105
- ? - TinyMCE ?