/*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
};\r
});\r
\r
+/**\r
+ * Loads a specific language file, or auto detect it. A callback is\r
+ * then called when the file gets loaded.\r
+ * @param {String} pluginName The name of the plugin to which the provided translation\r
+ * should be attached.\r
+ * @param {String} languageCode The code of the language translation provided.\r
+ * @param {Object} languageEntries An object that contains pairs of label and\r
+ * the respective translation.\r
+ * @example\r
+ * CKEDITOR.plugins.setLang( 'myPlugin', 'en', {\r
+ * title : 'My plugin',\r
+ * selectOption : 'Please select an option'\r
+ * } );\r
+ */\r
CKEDITOR.plugins.setLang = function( pluginName, languageCode, languageEntries )\r
{\r
- var plugin = this.get( pluginName );\r
- plugin.lang[ languageCode ] = languageEntries;\r
+ var plugin = this.get( pluginName ),\r
+ pluginLangEntries = plugin.langEntries || ( plugin.langEntries = {} ),\r
+ pluginLang = plugin.lang || ( plugin.lang = [] );\r
+\r
+ if ( CKEDITOR.tools.indexOf( pluginLang, languageCode ) == -1 )\r
+ pluginLang.push( languageCode );\r
+\r
+ pluginLangEntries[ languageCode ] = languageEntries;\r
};\r