JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.6.1
[ckeditor.git] / _source / core / plugins.js
index 5f549cb..fda9c88 100644 (file)
@@ -1,5 +1,5 @@
 /*\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
@@ -76,8 +76,28 @@ CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function
                };\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