Index: typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
===================================================================
--- typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php	(révision 10498)
+++ typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php	(copie de travail)
@@ -280,6 +280,10 @@
 				$this->siteURL = preg_replace('/^(http|https)/', 'https', $this->siteURL);
 				$this->hostURL = preg_replace('/^(http|https)/', 'https', $this->hostURL);
 			}
+				// Register RTE windows
+			$this->TCEform->RTEwindows[] = $PA['itemFormElName'];
+			$textAreaId = preg_replace('/[^a-zA-Z0-9_:.-]/', '_', $PA['itemFormElName']);
+			$textAreaId = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $textAreaId));
 
 			/* =======================================
 			 * LANGUAGES & CHARACTER SETS
@@ -370,6 +374,15 @@
 				// Preloading the pageStyle and including RTE skin stylesheets
 			$this->addPageStyle();
 			$this->addSkin();
+				// Re-initialize the scripts array so that only the cumulative set of plugins of the last RTE on the page is used
+			$this->cumulativeScripts[$this->TCEform->RTEcounter] = array();
+			$this->includeScriptFiles($this->TCEform->RTEcounter);
+			$this->buildJSMainLangFile($this->TCEform->RTEcounter);
+				// Register RTE in JS:
+			$this->TCEform->additionalJS_post[] = $this->registerRTEinJS($this->TCEform->RTEcounter, $table, $row['uid'], $field, $textAreaId);
+				// Set the save option for the RTE:
+			$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId, $PA['itemFormElName']);
+			$this->TCEform->additionalJS_delete[] = $this->setDeleteRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId);
 				// Loading JavaScript files and code
 			if ($this->TCEform->RTEcounter == 1) {
 				$this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
@@ -395,11 +408,6 @@
 					$value = $plugin->transformContent($value);
 				}
 			}
-				// Register RTE windows
-			$this->TCEform->RTEwindows[] = $PA['itemFormElName'];
-			$textAreaId = preg_replace('/[^a-zA-Z0-9_:.-]/', '_', $PA['itemFormElName']);
-			$textAreaId = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $textAreaId));
-
 				// Check if wizard_rte called this for fullscreen edtition; if so, change the size of the RTE to fullscreen using JS
 			if (basename(PATH_thisScript) == 'wizard_rte.php') {
 				$this->fullScreen = true;
@@ -407,14 +415,6 @@
 				$editorWrapHeight = '100%';
 				$this->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border: 1px solid black; padding: 2px 0px 2px 2px;';
 			}
-
-				// Register RTE in JS:
-			$this->TCEform->additionalJS_post[] = $this->registerRTEinJS($this->TCEform->RTEcounter, $table, $row['uid'], $field, $textAreaId);
-
-				// Set the save option for the RTE:
-			$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId, $PA['itemFormElName']);
-			$this->TCEform->additionalJS_delete[] = $this->setDeleteRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId);
-
 				// Draw the textarea
 			$visibility = 'hidden';
 			$item = $this->triggerField($PA['itemFormElName']).'
@@ -732,11 +732,9 @@
 	 *
 	 * @param	integer		$RTEcounter: The index number of the current RTE editing area within the form.
 	 *
-	 * @return	string		the html code for loading the Javascript Files
+	 * @return	void
  	 */
-	function loadJSfiles($RTEcounter) {
-			// Re-initialize the scripts array so that only the cumulative set of plugins of the last RTE on the page is used
-		$this->cumulativeScripts[$RTEcounter] = array();
+	protected function includeScriptFiles($RTEcounter) {
 		$this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea.js', 'htmlarea', 'js', '', TRUE);
 		if ($this->client['browser'] == 'msie') {
 			$this->writeTemporaryFile('EXT:' . $this->ID . '/htmlarea/htmlarea-ie.js', 'htmlarea-ie', 'js', '', TRUE);
@@ -747,9 +745,16 @@
 			$extensionKey = is_object($this->registeredPlugins[$pluginId]) ? $this->registeredPlugins[$pluginId]->getExtensionKey() : $this->ID;
 			$this->writeTemporaryFile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $pluginId . '/' . strtolower(preg_replace('/([a-z])([A-Z])([a-z])/', "$1".'-'."$2"."$3", $pluginId)) . '.js', $pluginId, 'js', '', TRUE);
 		}
-		$this->buildJSMainLangFile($RTEcounter);
-			// Avoid re-initialization on AJax call when RTEarea object was already initialized
-		$loadJavascriptCode = '<script type="text/javascript" src="' . $this->doConcatenate($RTEcounter) . '"></script>'. LF;
+	}
+	/**
+	 * Return the HTML code for loading the Javascript files
+	 *
+	 * @param	integer		$RTEcounter: The index number of the current RTE editing area within the form.
+	 *
+	 * @return	string		the html code for loading the Javascript Files
+ 	 */
+	protected function loadJSfiles($RTEcounter) {
+		$loadJavascriptCode = '<script type="text/javascript" src="' . $this->doConcatenate($RTEcounter) . '"></script>' . LF;
 		$loadJavascriptCode .= t3lib_div::wrapJS('
 			if (typeof(RTEarea) == "undefined") {
 				RTEarea = new Object();
@@ -1003,7 +1008,7 @@
 		}
 			// Include JS arrays of configured classes
 		$configureRTEInJavascriptString .= '
-			RTEarea[editornumber].classesUrl = "' . $this->writeTemporaryFile('', 'classes_'.$LANG->lang, 'js', $this->buildJSClassesArray()) . '";';
+			RTEarea[editornumber].classesUrl = "' . $this->writeTemporaryFile('', 'classes_' . $this->language, 'js', $this->buildJSClassesArray(), TRUE) . '";';
 		return $configureRTEInJavascriptString;
 	}
 
Index: typo3/sysext/rtehtmlarea/extensions/TYPO3Link/class.tx_rtehtmlarea_typo3link.php
===================================================================
--- typo3/sysext/rtehtmlarea/extensions/TYPO3Link/class.tx_rtehtmlarea_typo3link.php	(révision 10498)
+++ typo3/sysext/rtehtmlarea/extensions/TYPO3Link/class.tx_rtehtmlarea_typo3link.php	(copie de travail)
@@ -82,7 +82,7 @@
 			}
 			if (is_array($RTEProperties['classesAnchor.'])) {
 				$registerRTEinJavascriptString .= '
-			RTEarea['.$RTEcounter.'].buttons.'. $button .'.classesAnchorUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('', 'classesAnchor_'.$this->htmlAreaRTE->contentLanguageUid, 'js', $this->buildJSClassesAnchorArray()) . '";';
+			RTEarea['.$RTEcounter.'].buttons.'. $button .'.classesAnchorUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('', 'classesAnchor_'.$this->htmlAreaRTE->contentLanguageUid, 'js', $this->buildJSClassesAnchorArray(), TRUE) . '";';
 			}
 			$registerRTEinJavascriptString .= '
 			RTEarea['.$RTEcounter.'].buttons.'. $button .'.additionalAttributes = "external' . ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes'] ? (',' . $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes']) : '') . '";';
Index: typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php
===================================================================
--- typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php	(révision 10498)
+++ typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php	(copie de travail)
@@ -117,6 +117,10 @@
 			$this->siteURL = preg_replace('/^(http|https)/', 'https', $this->siteURL);
 			$this->hostURL = preg_replace('/^(http|https)/', 'https', $this->hostURL);
 		}
+			// Register RTE windows:
+		$this->TCEform->RTEwindows[] = $PA['itemFormElName'];
+		$textAreaId = preg_replace('/[^a-zA-Z0-9_:.-]/', '_', $PA['itemFormElName']);
+		$textAreaId = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $textAreaId)) . '_' . strval($this->TCEform->RTEcounter);
 		/* =======================================
 		 * LANGUAGES & CHARACTER SETS
 		 * =======================================
@@ -209,6 +213,14 @@
 			// Preloading the pageStyle and including RTE skin stylesheets
 		$this->addPageStyle();
 		$this->addSkin();
+			// Re-initialize the scripts array so that only the cumulative set of plugins of the last RTE on the page is used
+		$this->cumulativeScripts[$this->TCEform->RTEcounter] = array();
+		$this->includeScriptFiles($this->TCEform->RTEcounter);
+		$this->buildJSMainLangFile($this->TCEform->RTEcounter);
+			// Register RTE in JS:
+		$this->TCEform->additionalJS_post[] = $this->wrapCDATA($this->registerRTEinJS($this->TCEform->RTEcounter, '', '', '',$textAreaId));
+			// Set the save option for the RTE:
+		$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId);
 			// Loading ExtJs JavaScript files and inline code, if not configured in TS setup
 		if (!$GLOBALS['TSFE']->isINTincScript() || !is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.'])) {
 			$pageRenderer->loadExtJs();
@@ -240,18 +252,6 @@
 				$value = $plugin->transformContent($value);
 			}
 		}
-
-			// Register RTE windows:
-		$this->TCEform->RTEwindows[] = $PA['itemFormElName'];
-		$textAreaId = preg_replace('/[^a-zA-Z0-9_:.-]/', '_', $PA['itemFormElName']);
-		$textAreaId = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $textAreaId)) . '_' . strval($this->TCEform->RTEcounter);
-
-			// Register RTE in JS:
-		$this->TCEform->additionalJS_post[] = $this->wrapCDATA($this->registerRTEinJS($this->TCEform->RTEcounter, '', '', '',$textAreaId));
-
-			// Set the save option for the RTE:
-		$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId);
-
 			// draw the textarea
 		$item = $this->triggerField($PA['itemFormElName']).'
 			<div id="pleasewait' . $textAreaId . '" class="pleasewait" style="display: block;" >' . $TSFE->csConvObj->conv($TSFE->getLLL('Please wait',$this->LOCAL_LANG), $this->charset, $TSFE->renderCharset) . '</div>
